Search
 
SCRIPT & CODE EXAMPLE
 

R

convert a row to a column in r

library(tidyverse)

starting_df %>% 
  rownames_to_column() %>% 
  gather(variable, value, -rowname) %>% 
  spread(rowname, value)
Comment

convert a row to a column in r

starting_df <- data.frame(row.names= c(LETTERS[1:4]),
                          a = c(1:4),
                          b = seq(0.02,0.08,by=0.02),
                          c = c("Aaaa","Bbbb","Cccc","Dddd")
                )
Comment

PREVIOUS NEXT
Code Example
R :: r - extracting specific columns from a data frame 
R :: r remove row dataframe 
R :: null count in r 
R :: r read excel start from row 
R :: Getting rid of row names in R 
R :: rstudio plot not showing 
R :: r - reorder columns in data frame 
R :: filter na in r 
R :: how to change the font of the xlab in plot in r 
R :: get matrix row name r 
R :: remove column from matrix r 
R :: knn in r 
R :: R find n largest 
R :: r mode 
R :: insert character into string 
R :: prediction of linear model at a single point in R 
R :: if else functionr 
R :: count certain number of alphabets in a string r 
R :: r performance matrix for confusion matrix 
R :: add comma every 3 digits in r 
R :: save data frames in a loop r 
R :: legend in r 
Rust :: bevy window descriptor 
Rust :: get length of string rust 
Rust :: rust option get value 
Rust :: how to check for os in rust 
Rust :: transpose a matrix 
Rust :: armanriazi•rust•unsafe•extern 
Rust :: rust `cfg` which is always true / false 
Rust :: armanriazi•rust•concept•memoization•lazy•evaluation 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =