Extract data fron R dataset

0 votes
I am working on the titanic dataset in R. I need to extract the set of females in passenger class 1 and 2 only. What should be the command?
Jul 26, 2019 in Data Analytics by anonymous
46 views

1 answer to this question.

0 votes

You can use the dplyr package, 

Convert the titanic table into dataframe.

> library(dplyr)
> data("Titanic")

> titanic = as.data.frame.table(Titanic)

> titanic %>% filter(Class == "1st" | Class == "2nd")

Hope it helps!

answered Jul 29, 2019 by Cherukuri
• 32,440 points

Related Questions In Data Analytics

0 votes
1 answer

Dataset data type incorrect - R

You can assign datatypes for the field ...READ MORE

answered Jul 15, 2019 in Data Analytics by anonymous
69 views
0 votes
1 answer

R query and Data Science

Dear Deepika, Hope you are doing great. You can ...READ MORE

answered Dec 17, 2017 in Data Analytics by Sudhir
• 1,610 points
59 views
0 votes
1 answer

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

answered Dec 17, 2017 in Data Analytics by Sudhir
• 1,610 points
97 views
0 votes
3 answers

Code snippet to find number of null values in each column in a dataframe in R

colSums(is.na(data_frame_name)) will return you number of nulls ...READ MORE

answered Jul 5, 2019 in Data Analytics by sindhu
1,099 views
0 votes
1 answer

% of nulls for each column in the dataset - R

Use code as below -  lapply(air,function(x) { length(which(is. ...READ MORE

answered Jul 4, 2019 in Data Analytics by anonymous
• 32,440 points
61 views
0 votes
1 answer

How to add create a box plot with categorical columns?

One way is to convert to factor ...READ MORE

answered Jul 4, 2019 in Data Analytics by anonymous
• 32,440 points
130 views
0 votes
1 answer

Convert data.frame object into character vector/list

Hi, it is possible to store them ...READ MORE

answered Jul 9, 2019 in Data Analytics by anonymous
• 32,440 points
247 views
0 votes
1 answer

Create train and test data from dataset in R

Hi, Use sample or sample.split function to create ...READ MORE

answered Oct 13, 2019 in Data Analytics by anonymous
• 32,440 points
211 views
0 votes
2 answers

How to sort a data frame by columns in R?

You can use dplyr function arrange() like ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 32,440 points
238 views