Skip to main content
Statistics LibreTexts

17.6: Saving/Writing Data

  • Page ID
    7285
  • Saving or writing data that we have manipulated is a useful tool. It allows us to easily share datasets we have created with others. This is useful for collaboration, especially with other users who may not use R. Additionally, this will be useful for the book, as our new dataset is the one that will be worked with throughout the book. This dataset is much smaller than the one we originally downloaded and therefore will allow for quicker load times as well as hopefully reduce potential confusion. The code to save this data set is rather simple as well:

    # write.csv(ds, "Class Data Set.csv")

    This line of code allows us to save the dataset we created and saved in the object named ds as a new .csv file in our working directory called Class Data Set." Having successfully downloaded R and RStudio, learned some basic programming and data manipulation techniques, and saved the class data set to your working directory, you are ready to use the rest of the book to its fullest potential.