select column in dataframe r code example
Example 1: select columns in r
df %>% select(column1, column2)
Example 2: r - extracting specific columns from a data frame
### Solution 2
library(dplyr)
df %>%
select(A, B, E)
### Solution 2
new_df <- subset(df, select=c("A", "B", "C"))