Reputation: 207
I have a R data frame with 20,000 observations and 2100 variables, how do I export it to CSV format. I used write.table as follows
write.table(a,"Lucas1",sep=",",row.names=FALSE);
where a is the dataset. Lucas1 is the name of the file in which I want to store the data. I got following error
Error in if (inherits(X[[j]], "data.frame") && ncol(xj) > 1L) X[[j]] <- as.matrix(X[[j]]) :
missing value where TRUE/FALSE needed
I am a beginner in R, can anyone suggest me an easy solution to this problem?
Upvotes: 2
Views: 3241
Reputation: 4513
You might want to look at write_csv
in the new readr
package. I would imagine it would be quicker than utils::write.csv
. As an added bonus, you no longer need to specify row.names = FALSE
write_csv(a, "Lucas1.csv")
Upvotes: 4
Reputation: 886948
We can use
write.csv(a, "Lucas1.csv", quote=FALSE, row.names=FALSE)
Upvotes: 5