r get only columns code example
Example: 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"))
### Solution 2
library(dplyr)
df %>%
select(A, B, E)
### Solution 2
new_df <- subset(df, select=c("A", "B", "C"))