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)
[1] "Original dataframe"
col1 col2 col3
1 a 6 5
2 b 6 6
3 c 6 7
4 d 6 8
[1] "Modified dataframe"
col1 col2 col3
a a 6 5
b b 6 6
c c 6 7
d d 6 8