Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
wes-shen-poal
Helper III
Helper III

Make blank cells as NAs in R script visual

HI there,

 

Can someone kindly advise me on how I can make the blank cells in my dataset (i.e. the columns I have chosen) for a R Script Visual to be NAs within the R Script Editor?

 

The way I overcome it at the moment is to go to edit script in the external R IDE, I add na.strings argument in the read.csv command as per below:

 

`dataset` = read.csv('C:/Users/sh6668/AppData/Local/Radio/REditorWrapper_56fdaa70-81ea-4683-9bde-09ddd2f782ff/input_df_dbea42c1-2bea-4737-a2da-83deca7143a7.csv', check.names = FALSE, encoding = "UTF-8", blank.lines.skip = FALSE, na.strings = c(""," ","NA"));

 

And then copy this command back onto my R Script Editor for my R Script Visual.

Capture.PNG

 

But the approach just feels a bit long-winded. Is there a quicker way for me to do this?

 

 

Thanks in advance.

Wes

 

 

2 REPLIES 2
dkay84_PowerBI
Microsoft Employee
Microsoft Employee

Try adding a calc column within PBI that checks for blank and returns "NA" otherwise returns the value, then use this new column in your visual

thanks @dkay84_PowerBI

 

Do you know if there's a way I can do this within the R Script Editor (without having to create a new calc column)?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.