ANÁLISIS DE DATOS I
FACULTAD DE ECONOMÍA
PONTIFICIA UNIVERSIDAD CATÓLICA DEL ECUADOR
DEBER 1: R
Fecha de entrega: Martes 10 de septiembre de 2019 , 17h00
Please answer the following questions. This document should be sent to
[Link]@[Link].
1. If I execute the expression x <- 4 in R, what is the class of the object `x' as
determined by the `class()' function?
2. What is the class of the object defined by the expression x <- c(4, "a", TRUE)?
3. If I have two vectors x <- c(1,3, 5) and y <- c(3, 2, 10), what is produced by the
expression cbind(x, y)?
4. Suppose I have a vector x <- c(3, 5, 1, 10, 12, 6) and I want to set all elements of this
vector that are less than 6 to be equal to zero. What R code achieves this?
Use the data in the file [Link] to answer the following questions .
5. In the dataset provided for this workshop, what are the column names of the
dataset?
6. Extract the first 2 rows of the data frame and print them to the console. What
does the output look like?
7. How many observations (i.e. rows) are in this data frame?
8. Extract the last 2 rows of the data frame and print them to the console. What
does the output look like?
9. What is the value of Ozone in the 47th row?
10. How many missing values are in the Ozone column of this data frame?
11. What is the mean of the Ozone column in this dataset? Exclude missing values
(coded as NA) from this calculation.
12. Extract the subset of rows of the data frame where Ozone values are above 31
and Temp values are above 90. What is the mean of Solar.R in this subset?
13. What is the mean of "Temp" when "Month" is equal to 6?
14. What was the maximum ozone value in the month of May (i.e. Month is equal to
5)?