top of page

Extracting specific columns from a data frame in R

R programming
R Programming Assignment Help

Using the dplyr package.

Suppose df is data.frame in r


Use the following code:


library(dplyr)

1. Using "%>%" pipe expression

df %>% select(A, B, E)

Here A,B,C are columns name


2. Without pipe expression:

select (df, A, B, C)


3. Select columns range:

select (df, 1 : 3)

in this case output will be from column 1 to 3.



If you like Codersarts blog and looking for Assignment help,Project help, Programming tutors help and suggestion you can send mail at contact@codersarts.com.


Please write your suggestion in comment section below if you find anything incorrect in this blog post


bottom of page