Save data from Microstrategy into CSV.file in Rstudio

Hai All,

May I know how to save the data from Microstrategy into CSV.file?
I use this code below to save in CSV.file and it succesfull but the data is blank only the title is appear.

I am a little confused about your goal:
on the one hand you say that you want to export data from Microstrategy into a CSV-file and on the other hand I see that you try to use an R-function to write into a CSV-file (so clearly from R).

And I think you were confused about the use of quotes and back-ticks.

Assuming that you want to use the R function write.csv to write an R object with dimension 15x4 look at the following code:

`Bantuan - Kategori Bantuan` = data.frame(a=1:15,b=15:1,c=1:15,d=15:1)
write.csv(`Bantuan - Kategori Bantuan`,'yak1.csv',row.names=FALSE)
write.csv("Bantuan - Kategori Bantuan",'yak2.csv',row.names=FALSE) 

In the first line I create an object that is a data.frame of the same dimensions as yours that I give the name "Bantuan - Kategori Bantuan". Because that name contains spaces I have to use special syntax: surround the name with back-ticks (`)

In the second line I write that object by specifying its name (again with back-ticks) to yak1.csv with the expected result: 15 datalines with a header. See below.

The object that I write in the third line is a characterstring (ordinary double quotes and no back-ticks) so that character string is written to yak2.csv. Again see below.



This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.