Answers for "how to change row names in dataframe r"

R
1

r change row names of a dataframe

# Basic syntax:
rownames(your_dataframe) <- new_names
# Note, the new_names has to be the same length as the dataframe

# Example usage:
# Say you want to set the rownames to be numbered 1-end:
rownames(your_dataframe) <- 1:nrow(your_dataframe)
Posted by: Guest on October-10-2020
0

R change column to row names

samp2 <- samp[,-1]
rownames(samp2) <- samp[,1]
Posted by: Guest on May-11-2021

Code answers related to "how to change row names in dataframe r"

Browse Popular Code Answers by Language