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 in Data Analytics by anonymous
13 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 by Cherukuri
• 21,470 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 in Data Analytics by anonymous
22 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
27 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
43 views
0 votes
2 answers

Filtering R data-frame with multiple conditions

librarry(dplyr) dataset >%> filter((a ==1,b>15 ) | (a==2,b&g ...READ MORE

answered Aug 8 in Data Analytics by anonymous
4,763 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 in Data Analytics by sindhu
38 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 in Data Analytics by anonymous
• 21,470 points
16 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 in Data Analytics by anonymous
• 21,470 points
32 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 in Data Analytics by anonymous
• 21,470 points
23 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 4 days ago in Data Analytics by anonymous
• 21,470 points
98 views
0 votes
2 answers

Splitting the data into training and testing sets - R

Hi, Try like this. train = sample(x = ...READ MORE

answered 4 days ago in Data Analytics by anonymous
• 21,470 points
765 views