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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Lopez0090
Helper III
Helper III

Eliminate the columns that are automatically created when using R to output data.

I am running the following R script in Power BI Desktop (Query Editor).

However, there are blank column names (indexes?) in the output data. are automatically created in the output data.

 

Is there a way to prevent this column from being created,

or is it possible to output the column name as something arbitrary instead of blank?

currentDate <- Sys.Date()
output <- as.data.frame(dataset)
FileName <- paste("C://test/test", currentDate, ".csv")
write.csv(dataset, file = FileName)

 81926.jpg

 

If anyone knows a good way to do this, could you please let me know?

 

Best regards, Lopez

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Lopez0090 , In power query, select the columns you want and use option remove others, this make sure any additional column will get deleted

View solution in original post

2 REPLIES 2
Lopez0090
Helper III
Helper III

@amitchandak 

Thank you for your answer.

I apologize for my lack of explanation. The "columns with blank names" are not displayed in Power Query.

What is causing the problem is that when I run the R script and output to a csv file, it adds "columns with blank column names".

So I'm thinking it's caused by the R script, do you know what it is?

 

Best regards

 

amitchandak
Super User
Super User

@Lopez0090 , In power query, select the columns you want and use option remove others, this make sure any additional column will get deleted

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.