{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Austin Wen Assignment6

# Austin Wen Assignment6 - A ustin Wen STAT 4360 HW...

This preview shows pages 1–4. Sign up to view the full content.

Austin Wen STAT 4360 HW 6 ### Question1 ### x = c(0,1,0,NA,0,0,0,0,0,1,1,1,0,0,3,0,0,0,0,0,2,0,1) factor(x, levels = c("0","1","2","3","NA")) [1] 0 1 0 <NA> 0 0 0 0 0 1 1 1 0 0 3 [16] 0 0 0 0 0 2 0 1 Levels: 0 1 2 3 NA table(factor(x, levels = c("0","1","2","3","NA"))) 0 1 2 3 NA 15 5 1 1 0 mean(x,na.rm=TRUE) [1] 0.4545455 ###Question2### ##a.## data(mtcars) ##b.## names(mtcars) [1] "mpg" "cyl" "disp" "hp" "drat" "wt" "qsec" "vs" "am" "gear" "carb" ##c.## max(mtcars\$mpg) [1] 33.9 ##d.## mtcars[mtcars\$mpg==33.9,] mpg cyl disp hp drat wt qsec vs am gear carb Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.9 1 1 4 1 ##e.##

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
mtcars[rownames(mtcars)=="Valiant",4] [1] 105 ##f.## mtcars[1:5,] mpg cyl d isp hp drat wt qsec vs am gear carb Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4 Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4 Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1 Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1 Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2 ##g.## mtcars[rownames(mtcars)=="Merc 450SLC",] mpg cyl disp hp drat wt qsec vs am gear carb Merc 450SLC 15.2 8 275.8 180 3.07 3.78 18 0 0 3 3 ##Question3## A = matrix( c(2, 4, 6), nrow=1, ncol=3)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern