How do I edit a csv in r to change the headers and data

Hi, I’m new to r and would like to edit a CSV IN R so I can use this data to create graphs. I have no clue how to do this. I’ve imported the data but I need to edit the actual data in the csv in R to change the headers etc and then I need to make this into a graph. I’m just looking for some general advice.


I assume you have read the data into a data frame. You can change the column names with the colnames() function. For example, if your data are in a data frame named DF that has three columns, you can set their names like this

colnames(DF) <- c("X_value", "Y_Value", "Group")

Since you are new to R, I will ask why do you need to change the column names?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.