'How to save a new data frame in R

I am very new to R so I am not sure how to save a new data frame in R. May I know how to do it? I used this code to combine rows in my data frame.

my_data %>% 
  bind_rows(my_data)

May I know how to save the changes I made to my data frame, or save it as a new one? Thank you.



Solution 1:[1]

You can use the following code:

new_data <- my_data%>% bind_rows(my_data)

The <- can be use create a new name for your dataframe and save it.

Solution 2:[2]

if you want to get the data frame in to a file:

df_new <- my_data %>%
          bind_rows(my_data)


write.csv(df_new, "C://Users/Name/Folder/data.csv", row.names=FALSE)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Quinten
Solution 2 Hansel Palencia