get column from list of dataframes R

前端 未结 1 1485
生来不讨喜
生来不讨喜 2021-02-20 02:30

I am an R beginner and I am stuck on this problem. I had a dataframe and by using the split() function I have created a list of dataframes, e.g:

dfList <- spl         


        
相关标签:
1条回答
  • 2021-02-20 03:11

    I'm putting docendo's comment here to close out the question.

    If you want to extract an element from a list (and treat it like a data.frame) rather than subset a list (to create a smaller list), you need to use the [[ ]] syntax. Plus, to get a column by index from a data.frame, you either need to use [[ idx ]] or [, idx ]. These are pretty basic indexing operations that you will probably want to review if you will be programming in R. So your "correct" call is probably

    dfList[[1]][[2]]
    
    0 讨论(0)
提交回复
热议问题