Data Handling
Data Handling
classifying factor, compute a function on the subsets, and return the results?
tapply
A hospital data contains patient's age and treatment they are undergoing. Which
function can be used to find average of patients undergoing each of the treatments?
tapply
For a given matrix mat, how do you increment every element of the matrix by 3 and
return a vector. (I) sapply(mat, function(x,y) sum(x)+y,y=3) (II) sapply(mat,
function(x) sum(x)+3)
I & II
The function write.csv() exports data into a file. However, this function by
default adds rownames to the file. Which argument can be used to turn off addition
of rownames?
rownames=F
nrows and skip arguments in the read.table() command can be used to get
All the options
Which of the following functions can be used to find the number or rows and columns
in a dataset?
dim
Which of the following functions does not list the total number of observations in
a dataset?
head
Which of the following functions lists all columns in a dataset with few values
from each column?
glimpse
In the hflights dataset, how many flights were cancelled in the month of January
2011
209
In the mtcars dataset, how many cars provide a mileage of less than 20 mpg?
18
dplyr never prints row names since no dplyr method is guaranteed to preserve them.
true
If x and y are two tbls, which of the following joins return all rows from x and y
irrespective of matching values?
full join
If x and y are two tbls, which of the following joins return all rows from x where
there are matching values in y, and all columns from x and y
inner join
If x and y are two tbls, which of the following joins return all rows from x where
there are not matching values in y, keeping just columns from x?
anti-join
If x and y are two tbls, which of the following joins return all rows from y, and
all columns from x and y?
right join
If x and y are two tbls, which of the following joins return all rows from x where
there are matching values in y, keeping just columns from x?
semi join