R中的数据转换

R中的数据转换,r,R,我的数据框架是 rows probes 3 244903_at 4 244904_at 6 244906_at 12 244912_at 13 244913_at 20 244920_s_at 21 244921_s_at 23 244923

我的数据框架是

         rows     probes
            3    244903_at
            4    244904_at 
            6    244906_at
            12   244912_at
            13   244913_at
            20   244920_s_at
            21   244921_s_at
            23   244923_s_at
            26   244924_at
并希望将其转换为以下内容:

     structure(c(3L, 4L, 6L, 12L, 13L, 20L, 21L, 23L, 24L, 26L), .Names = c("244903_at", 
        "244904_at", "244906_at", "244912_at", "244913_at", "244920_s_at", 
        "244921_s_at", "244923_s_at", "244924_at"))
我试着用

            df<-as.vector(df)

df那么,您想获取数据帧的
列,并将其
探针
作为名称吗

x <- setNames(df$rows, df$probes)
x
x <- structure(df$rows, names=as.character(df$probes))