r - Error exporting data.frame as csv -


exporting data.frame .csv code.

write.csv(df, "name.csv") 

logittv.rda has 3000 rows , 4 columns.

my code has error when identifying data.frame.

load("~/home automation/logittv.rda") write.csv(logittv.rda, "logittv.csv") 

error in is.data.frame(x) : object 'logittv.rda' not found

checked following:

1) cleaned console of previous history

2) working directory set ~/home automation/

anything else check preventing error?

thanks

logittv.rda is, confusingly, not name of object gets loaded.

try:

loadedobj <- load("~/home automation/logittv.rda") write.csv(get(loadedobj), file="logittv.csv") 

this assumes .rda file contains single r object, , data frame or matrix.

it nice if write.csv had way accept name of object instead of object (so get() unnecessary), don't know of one.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -