Search
 
SCRIPT & CODE EXAMPLE
 

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)
Comment

Convert Values in Column into Row Names of DataFrame in R

[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
Comment

PREVIOUS NEXT
Code Example
R :: excecute a for loop line by line in r 
R :: r for data science 
R :: imputation in r 
R :: emf from r plot 
Rust :: rust reverse range 
Rust :: cargo insall cargo-cahe this version of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions. 
Rust :: rust vec cannot move 
Rust :: rust implement debug for struct 
Rust :: rust request get headers 
Rust :: rust .0 
Rust :: host rust server 
Rust :: loop rust 
Rust :: rust vec to array 
Rust :: rust variables in println 
Rust :: rust while loop 
Rust :: hello world in rust 
Rust :: armanriazi•rust•unsafe•extern 
Rust :: armanriazi•rust•unsafe•comparison•references•smartpointers•rawpointer 
Rust :: greater than equal to rust 
Rust :: armanriazi•rust•t•opt•? 
Rust :: rust•armanriazi•slice•vs•char•vec 
Rust :: rust tuple vs vec 
Lua :: lua dump table 
Lua :: Lua array add item 
Lua :: roblox lua gui drag 
Lua :: lua printing 
Lua :: lua infinite 
Lua :: print a table in lua 
Lua :: delete part on touch roblox 
Lua :: wails build 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =