Problems exporting


I am a new beginner. I have analysed csv files with a code I got and everything seems to work except I can not get it to be exported back to me as an excel file. It seems it does not find my file. What am I missing. How do I choose the file? or exactly what should I put as "file" and how do I connect it? Tried youtube but do not understand.

This is the code and the error:

write.table(, file = 'test.csv', sep = ';', row.names = F)
Error in `[.data.frame`(interuption, , 3) : undefined columns selected
In addition: Warning message:
In read.table(file = filename, sep = ",", stringsAsFactors = F,  :
 Show Traceback
 Rerun with Debug
 Error in `[.data.frame`(interuption, , 3) : undefined columns selected 

Best regards/ Sanna


For documentation on the write.table function, type ?write.table into your R console and click enter.
The first argument is the object that you want to save. Since write.table output to a table (with a certain number of rows and columns), you'll ideally give it a matrix or data.frame.

I am not familiar with but it looks like a function. Are you should you don't have a data.frame you're trying to save named something other than

For example:

df <- data.frame(
  c1 = 1:4,
  c2 = c(LETTERS[1:4])
write.table(df, file = 'test.csv', sep = ';', row.names = F)

Here I setup a data.frame named df, and saved it to a semi-colon separated csv file named "test.csv".