How to get a .csv file into R?

后端 未结 6 398
名媛妹妹
名媛妹妹 2020-11-30 07:27

I have this .csv file:

ID,GRADES,GPA,Teacher,State

3,\"C\",2,\"Teacher3\",\"MA\"

1,\"A\",4,\"Teacher1\",\"California\"

And what I want to

6条回答
  •  情歌与酒
    2020-11-30 07:56

    Since you say you want to access by position once your data is read in, you should know about R's subsetting/ indexing functions.

    The easiest is

    df[row,column]
    #example
    df[1:5,] #rows 1:5, all columns
    df[,5] #all rows, column 5. 
    

    Other methods are here. I personally use the dplyr package for intuitive data manipulation (not by position).

提交回复
热议问题