Answers for "r get column of dataframe"

C
0

r get name of column in data frame

colnames(<dataframe>)
#or
names(<dataframe>)
Posted by: Guest on February-26-2021
1

how to extract rows and column of dataframe in r

df[,] #All rows and cols

df[1,] #1st row and all cols

df[1:2,] #First two rows and all cols

df[c(1,3),] #First and third row and all cols

df[1,2:3] #First row and 2nd-3rd col

df[1:2,2:3] #First,second row and Second and third cols

df[,1] #All rows and just first column

#df[,c(1,3)] # all rows and first and third col
Posted by: Guest on November-13-2020

Code answers related to "r get column of dataframe"

Code answers related to "C"

Browse Popular Code Answers by Language