Complete the code to select the first row of the data frame df.
df[[1], ]In R, to select the first row of a data frame, you use df[1, ]. The number 1 specifies the first row.
Complete the code to select the column named age from the data frame df.
df$[1]To select a column by name in R, use the dollar sign $ followed by the column name, like df$age.
Fix the error in the code to select the element in the second row and third column of df.
df[[1], 3]
To select the element in the second row and third column, the row index should be 2. So the correct code is df[2, 3].
Fill both blanks to select rows where the score column is greater than 50.
df[df$[1] [2] 50, ]
To select rows where the score column is greater than 50, use df[df$score > 50, ].
Fill all three blanks to create a new data frame new_df with only the name and age columns for rows where age is less than 30.
new_df <- df[df$[1] [2] 30, c([3])]
name and age.c().This code filters rows where age is less than 30 and selects only the name and age columns. The correct code is new_df <- df[df$age < 30, c("name", "age")].