Practice 4.LOOKING AT DATA docx

docx

School

University of Illinois, Urbana Champaign *

*We aren’t endorsed by this school

Course

557

Subject

Electrical Engineering

Date

Feb 20, 2024

Type

docx

Pages

2

Uploaded by MegaRose12943

Report
EXERCISE TOPIC: LOOKING AT DATA Questions 1. A ___________ is the default class for data read into R using functions like read.csv() and read.table(). A. matrix B. data frame C. vector D. list Answer – B. data frame 2. Print the number of rows and columns in the variable ‘plants’. print(dim(plants)) 3. Write the R code to print the first 20 rows of the data frame ‘plants’. head(plants, 20) 4. Write the R code to print the last 20 rows of the data frame ‘plants’. tail(plants, 20) 5. Use a function in R to understand the structure of data frame ‘mtcars’. str(mtcars) 6. What is the alternative name for categorical variables in R? A. Factual Variables B. Matrix Variables C. Factor Variables Answer – C. Factor Variables TOPIC: BASE GRAPHICS Questions 1. ______ function is used to access the help page. A. assist() B. help() C. helpage() Answer – B. help()
2. Plot the built in data set ‘airmiles’ in R. plot(airmiles) 3. Plot the above with lables: x: My X Label – Time y: My Y Label – Airmiles plot(airmiles, xlab="My X Label – Time", ylab="My Y Label – Airmiles") 4. Plot the dataset ‘airmiles’ with the title “My Plot”. plot(airmiles, main="My Plot") 5. Plot a Histogram for the column ‘disp’ in the data set ‘mtcars’. hist(mtcars$disp) 6. Plot the data set ‘women’ while limiting the x-axis to 55 through 70. plot(women, xlim=c(55, 70)) 7. Can you set limits for the Y-axis like done above for the X-axis? If yes, write down what you would use to limit the above from 125 to 155. plot(women, ylim=c(125, 155)) 8. Create a box plot with the data set ‘plants’ for the columns ‘pH_Min’ and ‘pH_Max’. boxplot(plants$pH_Min, plants$pH_Max, names=c("pH_Min", "pH_Max"))
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help