0% found this document useful (0 votes)
4 views4 pages

R Programming: Data Analysis Exercises

Introduction to R, some applied exercises

Uploaded by

jfnunezt65
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

R Programming: Data Analysis Exercises

Introduction to R, some applied exercises

Uploaded by

jfnunezt65
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1

Deber R:1
Julia Fernanda Núñez Tibanquiza
Estadística Descriptiva
Pontificia Universidad Católica del Ecuador
18,03 del 2022
Prof. Richard Amaguaña
2

Deber R:1

1. If I execute the expression x4 in R, what is the class of the object “x” as determined by

the “class ()” function?

I obtained “numeric”

2. What is the class of the object defined by the expression x< - c (4,” a”, True?

Its class is character

3. If I have two vectors x<- c (1,2,3) and y<- c (3,2,10). What is produced by the

expression cbind (x, y)?

I get a matrix

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?

The code is “[Link]”

5. In the dataset provided for this workshop, what are the column names of the dataset?

The column names are "Ozone”, "Solar.R”, "Wind", "Temp”, "Month", "Day"

6. Extract the first 2 rows of the data frame and print them to the console. What does the

output look like?

Ozone Solar.R Wind Temp Month Day

1 41 190 7.4 67 5 1
3

2 36 118 8.0 72 5 2

7. How many observations (i.e rows) are in this data frame?

The are 153 observations

8. Extract the last 2 rows of the data frame and print them to the console. What does the

output look like?

It looks like

Month Day

152 9 29

153 9 30

9. What is the value of Ozone in the 47th row?

Is 21

10. How many missing values are in the Ozone column of this data frame?

There are 44 missing values

11. What is the mean of the Ozone column in this dataset? Exclude missing values (coded as

NA) from this calculation.

It is 42.12

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?

The mean of Solar.R in this subset is 185.93

13. What is the mean of “Temp” when “Month: is equal to 6?

The mean is 79

14. What was the maximum ozone value in the month of May (i.e Month is equal to 5)?
4

The maximum ozone value in the month of May is 31

You might also like