Transposing in dplyr

后端 未结 4 800
故里飘歌
故里飘歌 2021-02-02 14:04

I have the following data.frame

df = structure(list(HEADER = c(\"HOME_TRPM\", \"AWAY_TRPM\", \"HOME_TEAM\",\"AWAY_TEAM\"),
                     price = c(\"0.863         


        
4条回答
  •  逝去的感伤
    2021-02-02 14:14

    spread is retired, tidyr now suggests the usage of pivot_wide():

    library(tidyverse)
    df %>%
        pivot_wider(names_from = HEADER, values_from = price)
    

提交回复
热议问题