ACTL1101 Lecture Notes - Lecture 4: Gzip, Standard Deviation, Apache Spark
Document Summary
# create the new variable mtcars %>% mutate(kmpg=mpg/1000) %>% # group cars by how many cylinders they have summarise(avg_kmpg = mean(kmpg), # find the average kmpg for each group sd_kmpg = sd(kmpg), # find the standard deviation of kmpg for each group num_cars = n()) # find the number of cars in each group. Content type "application/x-gzip" length 5686536 bytes (5. 4 mb) downloaded 5. 4 mb. The following objects are masked from (cid:528)package:stats(cid:529): filter, lag. > mtcars %>% mutate(kmpg=mpg/1000) mpg cyl disp hp drat wt qsec vs am gear carb kmpg. + # group cars by how many cylinders they have. + # find the average kmpg for each group. + # find the standard deviation of kmpg for each group. # a tibble: 3 x 4 cyl avg_kmpg sd_kmpg num_cars. > # find the number of cars in each group.