convert dataframe to new list

前端 未结 3 978
情歌与酒
情歌与酒 2021-01-29 12:22

I have a data.frame NOAA_OLR_TEST

NOAA_OLR_TEST <- structure(list(DATE_START = structure(c(1170720000, 1170806400,
1170892800, 1170979200, 1171065600, 1171152         


        
3条回答
  •  伪装坚强ぢ
    2021-01-29 12:59

    You can do this with data.table:

    library(data.table)
    setDT(NOAA_OLR_TEST)
    NOAA_OLR_TEST[,xy.list:=list(OLR_DATA_1,OLR_DATA_2,OLR_DATA_3,OLR_DATA_4,OLR_DATA_5)]
    NOAA_OLR_TEST[,(5:9):= NULL]
    
    is.list(NOAA_OLR_TEST$xy.list)
    [1] TRUE
    

提交回复
热议问题