How to use pull method In R Language
The pull method in the dplyr package in R is used to extract any column of the data frame in the form of a vector. The values displayed in the vector appeared in the same order in which they occur in the data frame.
Syntax : pull(col-name)
Arguments: col-name: the column name to be extracted as a vector
In the following code snippet, the values belonging to the column companies are extracted as a vector.
R
print ( "Extracting companies vector from data frame" ) print ( "Companies vector" ) data_frame %>% pull (companies) |
Output
Single-Table Analysis with dplyr using R Language
The dplyr package is used to perform simulations in the data by performing manipulations and transformations. It can be installed into the working space using the following command :
install.packages("dplyr")
Let’s create the main dataframe:
R
#installing the required libraries library (dplyr) #creating a data frame data_frame = data.frame (companies = c ( "Geekster" , "w3wiki" , "Wipro" , "TCS" , "w3wiki" , "w3wiki" , "TCS" , "Wipro" , "Geekster" , "Wipro" ), people = c (100, NA ,532,454,234,554,223,122,432,453), rating = c (4,3,5, NA ,5,3, NA ,4,5,2)) print ( "Original Data frame" ) print (data_frame) |
Output :
Contact Us