I am stuck on what ought to be fairly obvious, but…I’ve got dataframe that I created by importing a CSV with no headers. I can’t seem to figure out how to name my columns now. I’ve found lots of instructions for creating new dataframes or importing data with headers, but not for adding column/dimension names once my data is imported.
Share
names(df) <- c("col1", "col2", ...)colnames(df) <- ...will also work, since data.frames can be treated as matrices is many cases.