Ask Sawal

Discussion Forum
Notification Icon1
Write Answer Icon
Add Question Icon

How to convert data frame to ts in r?

1 Answer(s) Available
Answer # 1 #

To export iris to a file in CSV format we will use the write_csv() function: we just have to tell it the object we want to export (in this case an “iris” df) and the name (along with the path) of the file where we want to save it.

The full path can be specified. For example,

You don't need to specify the full path.

R will save the file to the working directory if we specify the name.

You can use the getwd function to find your working directory, or you can change it from the RStudio menus. For example,

The data files should be saved in a folder called / data/.

To export theiris data within the project, you have to do the following:

We can put the arguments in the function.

We exported "iris" to a file in a format called a CSV, now we are going to import it.

[3]
Edit
Query
Report
Googie Townes
Government Scientist