write.csv to personal computer

I am very new to R. I have joined two .cvs tables into one. I am wanting to save the newly created table to my computer in a cvs file.

write.csv(all_trips, "all_data")

write.csv(all_trips, "all_data" row.names = TRUE)

A file shows in the environment as being created. I want save it to my computer as .cvs.

seems so simple and yet I can't do it.

thanks in advance

First, you need a comma between the file name and the row.names argument. With that, the data should be written to "all_data" in your current working directory. (Note that it will be a CSV file but will not have the .csv extension unless you specify that by typing "all_data.csv" as the second argument.) If you want it in a different directory than the current working directory (which you can check by running getwd()), you need to specify the path.

1 Like

You need to specify the suffix in the file name such as:

write.csv(all_trips, "all_data.csv", row.names = TRUE)

Also it's CSV (comma separated values) not CVS

1 Like