Answers for "row as column in r"

R
0

convert a row to a column in r

library(tidyverse)

starting_df %>% 
  rownames_to_column() %>% 
  gather(variable, value, -rowname) %>% 
  spread(rowname, value)
Posted by: Guest on June-21-2020
0

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")
                )
Posted by: Guest on June-21-2020

Browse Popular Code Answers by Language