#rstats pipe中重命列名或行名
2019-07-31 本文已影响4人
董八七
library(tidyverse)
library(reshape2)
# magrittr
dat1 %<>% as.matrix %>% `colnames<-`(1:96) %>% melt %>% set_names(c("row","col","yield"))
# or
# dplyr
dat1 %<>% as.matrix %>% `colnames<-`(1:96) %>% melt %>% rename(row=Var1, col=Var2, yield=value)