Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

Convert Values in Column into Row Names of DataFrame in R

data_frame <- data.frame(col1=letters[1:4],
                         col2=6,col3=c(5:8))
  
print("Original dataframe")
print(data_frame)
  
# reassigning row names
rownames(data_frame) <- data_frame$col1
print("Modified dataframe")
print(data_frame)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Convert #Values #Column #Row #Names #DataFrame #R
ADD COMMENT
Topic
Name
8+6 =