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
614 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 30, 2019 by Cherukuri
• 33,030 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
1,641 views
+1 vote
1 answer

R query and Data Science

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

answered Dec 18, 2017 in Data Analytics by Sudhir
• 1,570 points
907 views
0 votes
1 answer

Big Data transformations with R

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

answered Dec 18, 2017 in Data Analytics by Sudhir
• 1,570 points
1,049 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
17,732 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
• 33,030 points
1,153 views
+1 vote
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
• 33,030 points
2,062 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
• 33,030 points
6,894 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 14, 2019 in Data Analytics by anonymous
• 33,030 points
3,313 views
+1 vote
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
• 33,030 points
1,839 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP