welcome to the co u rse
play

Welcome to the co u rse DATA VISU AL IZATION W ITH L ATTIC E IN - PowerPoint PPT Presentation

Welcome to the co u rse DATA VISU AL IZATION W ITH L ATTIC E IN R Deepa y an Sarkar Associate Professor , Indian Statistical Instit u te Data v is u ali z ation E x plorator y data anal y sis Presenting or reporting res u lts DATA


  1. Welcome to the co u rse DATA VISU AL IZATION W ITH L ATTIC E IN R Deepa y an Sarkar Associate Professor , Indian Statistical Instit u te

  2. Data v is u ali z ation E x plorator y data anal y sis Presenting or reporting res u lts DATA VISUALIZATION WITH LATTICE IN R

  3. Data v is u ali z ation frame w orks in R Base R graphics lattice based on " Trellis graphics " ( Cle v eland ) ggplot2 based on " Grammar of Graphics " ( Wilkinson ) N u mber of packages depending on these ( March 2017): graphics la � ice ggplot 2 CRAN 5612 3654 1566 CRAN + BioC 7889 4858 2038 DATA VISUALIZATION WITH LATTICE IN R

  4. The USCancerRates dataset Age - adj u sted death rates d u e to cancer ( per 100,000) Separatel y for males and females Co u nt y- le v el data for 1999-2003 A v ailable in the latticeExtra package DATA VISUALIZATION WITH LATTICE IN R

  5. The USCancerRates dataset data(USCancerRates, package = "latticeExtra") str(USCancerRates) 'data.frame': 3041 obs. of 8 variables: $ rate.male : num 364 346 341 336 330 ... $ LCL95.male : num 311 274 304 289 293 ... $ UCL95.male : num 423 431 381 389 371 ... $ rate.female : num 151 140 182 185 172 ... $ LCL95.female: num 124 103 161 157 151 ... $ UCL95.female: num 184 190 206 218 195 ... $ state : Factor w/ 49 levels "Alabama","Alaska",..: 1 1... $ county : chr [1:3041] "Pickens County" "Bullock County" ... DATA VISUALIZATION WITH LATTICE IN R

  6. A histogram library(lattice) histogram(~ rate.male, data = USCancerRates) DATA VISUALIZATION WITH LATTICE IN R

  7. A scatter plot xyplot(rate.female ~ rate.male, data = USCancerRates) DATA VISUALIZATION WITH LATTICE IN R

  8. The form u la histogram(~ rate.male, data = USCancerRates) xyplot(rate.female ~ rate.male, USCancerRates) ~ x in histogram() : x plo � ed on x - a x is y ~ x in xyplot() : x plo � ed on x - a x is y plo � ed on y - a x is Similar to modeling calls lm(rate.female ~ rate.male, data = USCancerRates) DATA VISUALIZATION WITH LATTICE IN R

  9. A v ersion for presentation DATA VISUALIZATION WITH LATTICE IN R

  10. Let ' s practice ! DATA VISU AL IZATION W ITH L ATTIC E IN R

  11. Optional arg u ments DATA VISU AL IZATION W ITH L ATTIC E IN R Deepa y an Sarkar Associate Professor , Indian Statistical Instit u te

  12. Arg u ments in lattice f u nctions Mandator y: x : form u la (� rst arg u ment , u s u all y not named ) data : dataset containing v ariables Optional : Some appl y to all f u nctions Some are speci � c to partic u lar f u nctions DATA VISUALIZATION WITH LATTICE IN R

  13. Common arg u ments : main , x lab , y lab histogram(~ rate.male, data = USCancerRates, main = "County-wise deaths due to cancer (1999-2003)", xlab = "Rate among males (per 100,000)") DATA VISUALIZATION WITH LATTICE IN R

  14. xyplot(rate.female ~ rate.male, data = USCancerRates, main = "County-wise deaths due to cancer (1999-2003)", xlab = "Rate among males (per 100,000)", ylab = "Rate among females (per 100,000)") DATA VISUALIZATION WITH LATTICE IN R

  15. Arg u ments of histogram () histogram(~ rate.male, USCancerRates, nint = 30) DATA VISUALIZATION WITH LATTICE IN R

  16. Arg u ments of xy plot () xyplot(rate.female ~ rate.male, USCancerRates, grid = TRUE, abline = c(0, 1)) DATA VISUALIZATION WITH LATTICE IN R

  17. Let ' s practice ! DATA VISU AL IZATION W ITH L ATTIC E IN R

  18. Bo x and w hisker plots and reordering le v els DATA VISU AL IZATION W ITH L ATTIC E IN R Deepa y an Sarkar Associate Professor , Indian Statistical Instit u te

  19. Bo x and w hisker plots : b w plot () bwplot(~ rate.male, data = USCancerRates) DATA VISUALIZATION WITH LATTICE IN R

  20. Comparati v e bo x and w hisker plots bwplot(state ~ rate.male, data = USCancerRates) DATA VISUALIZATION WITH LATTICE IN R

  21. Reordering factor le v els USCancerRates <- dplyr::mutate(USCancerRates, state.ordered = reorder(state, rate.male, median, na.rm = TRUE)) bwplot(state.ordered ~ rate.male, USCancerRates) DATA VISUALIZATION WITH LATTICE IN R

  22. Let ' s practice ! DATA VISU AL IZATION W ITH L ATTIC E IN R

Recommend


More recommend