1

私は次のデータフレームを持っています:

     PD4115a PD4088a  PD4192a      
   1 ABCA8   ATRX     ADAM32      
   2 ANK2    CDH9     C11orf30
   3 ANO3    CKAP2L   CCBL2      

私が欲しいのは、すべての値を組み合わせたリストです。

     1 ABCA8 ATRX ADAM32 ANK2 CDH9 C11orf30 ANO3CKAP2L CCBL2

それを手伝ってください、私はRの初心者です。

どうもありがとう

4

1 に答える 1

2

unlist()data.framesは「本当に」特別な種類のリストであるため、次のように使用できます。

df <- data.frame(A=letters[1:3], B=letters[4:6], stringsAsFactors = FALSE)
unlist(df)
#  A1  A2  A3  B1  B2  B3 
# "a" "b" "c" "d" "e" "f" 

## To help understand why it works, here are a few ways to see the sense 
## in which data.frames are lists 
is.list(df)         # Ask R
typeof(df)          # Check the storage mode
class(unclass(df))  # Strip off the "data.frame" class attribute
于 2012-10-26T18:56:05.667 に答える