Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Using R at NYT Graphics

9,987 views

Published on

Delivered by Josh Katz (Graphics Editor, The New York Times) at the 2016 New York R Conference on April 8th and 9th at Work-Bench. See the rest of the conference videos & presentations at http://www.rstats.nyc.

Published in: Data & Analytics
  • Be the first to comment

Using R at NYT Graphics

  1. 1. Using R at NYT Graphics Josh Katz Graphics Editor The New York Times
  2. 2. Text analysis
  3. 3. Spatial smoothing
  4. 4. Correlations
  5. 5. Live election forecasts
  6. 6. Seasonal adjustment
  7. 7. R do.call(rep, input) %>% strsplit(NULL) %>% sapply(sample) %>% apply(2, paste, collapse = "") final output from R returns to javascript as parsed JSON Javascript var R = require(“r-script"); var out = R("example.R") .data("hello world", 20) .callSync(); data is passed to R as variable input
  8. 8. R attach(input[[1]]) df %>% mutate(group = cut(rating, nGroups)) %>% group_by(group) %>% summarize_each(funs_(fxn)) %>% transmute(group = as.character(group), rating, advance) Javascript var R = require(“r-script"); R("example/ex-async.R") .data({df: attitude, nGroups: 3, fxn: "mean" }) .call(function(err, d) { if (err) throw err; console.log(d); });
  9. 9. Using R with Makefiles
  10. 10. What could go wrong?
  11. 11. > source(“r-work/fail.R”) Error in library(readr) : there is no package called ‘readr’
  12. 12. Error in library(kissmig) : there is no package called ‘kissmig’ Error in library(lazyData) : there is no package called ‘lazyData’ Error in library(ecotoxicology) : there is no package called ‘ecotoxicology’ Error in library(AdaptiveSparsity) : there is no package called ‘AdaptiveSparsity’ Error in library(FindMinIC) : there is no package called ‘FindMinIC’ Error in library(geoaxe) : there is no package called ‘geoaxe’ Error in library(JM) : there is no package called ‘JM’ Error in library(cvxbiclustr) : there is no package called ‘cvxbiclustr’ Error in library(cwm) : there is no package called ‘cwm’ Error in library(SEL) : there is no package called ‘SEL’ Error in library(ForIT) : there is no package called ‘ForIT’ Error in library(solidearthtide) : there is no package called ‘solidearthtide’ Error in library(MEMSS) : there is no package called ‘MEMSS’ Error in library(mirt) : there is no package called ‘mirt’ Error in library(marked) : there is no package called ‘marked’ Error in library(luzlogr) : there is no package called ‘luzlogr’ Error in library(corrgram) : there is no package called ‘corrgram’ Error in library(dynCorr) : there is no package called ‘dynCorr’ Error in library(DiceOptim) : there is no package called ‘DiceOptim’ Error in library(LCA) : there is no package called ‘LCA’ Error in library(ldbounds) : there is no package called ‘ldbounds’ Error in library(plotpc) : there is no package called ‘plotpc’ Error in library(ppiPre) : there is no package called ‘ppiPre’ Error in library(hcp) : there is no package called ‘hcp’ Error in library(CMC) : there is no package called ‘CMC’ Error in library(randstr) : there is no package called ‘randstr’ Error in library(clinfun) : there is no package called ‘clinfun’ Error in library(AutoModel) : there is no package called ‘AutoModel’ Error in library(SIMMS) : there is no package called ‘SIMMS’ Error in library(audiolyzR) : there is no package called is no package called ‘prob’ Error in library(seas) : there is no package called ‘seas’ Error in library(CopyDetect) : there is no package called ‘CopyDetect’ Error in library(ABHgenotypeR) : there is no package called ‘ABHgenotypeR’ Error in library(gettingtothebottom) : there is no package called ‘gettingtothebottom’ Error in library(flowDiv) : there is no package called ‘flowDiv’ Error in library(Sequential) : there is no package called ‘Sequential’ Error in library(smoothHR) : there is no package called ‘smoothHR’ Error in library(iemiscdata) : there is no package called ‘iemiscdata’ Error in library(RootsExtremaInflections) : there is no package called ‘RootsExtremaInflections’ Error in library(molaR) : there is no package called ‘molaR’ Error in library(KRLS) : there is no package called ‘KRLS’ Error in library(nls2) : there is no package called ‘nls2’ Error in library(SAMURAI) : there is no package called ‘SAMURAI’ Error in library(crimelinkage) : there is no package called ‘crimelinkage’ Error in library(DiffCorr) : there is no package called ‘DiffCorr’ Error in library(micromap) : there is no package called ‘micromap’ Error in library(Matrix.utils) : there is no package called ‘Matrix.utils’ Error in library(apcluster) : there is no package called ‘apcluster’ Error in library(bnclassify) : there is no package called ‘bnclassify’ Error in library(ctsem) : there is no package called ‘ctsem’ Error in library(fgpt) : there is no package called ‘fgpt’ Error in library(refset) : there is no package called ‘refset’ Error in library(ParallelPC) : there is no package called ‘ParallelPC’ Error in library(muhaz) : there is no package called ‘muhaz’ Error in library(relaxnet) : there is no package called ‘relaxnet’ Error in library(qualityTools) : there is no package called ‘qualityTools’ Error in library(PerformanceAnalytics) : there is no package called ‘PerformanceAnalytics’ ‘deconstructSigs’ Error in library(kzs) : there is no package called ‘kzs’ Error in library(heritability) : there is no package called ‘heritability’ Error in library(blme) : there is no package called ‘blme’ Error in library(dkDNA) : there is no package called ‘dkDNA’ Error in library(NBPSeq) : there is no package called ‘NBPSeq’ Error in library(profdpm) : there is no package called ‘profdpm’ Error in library(reports) : there is no package called ‘reports’ Error in library(wikibooks) : there is no package called ‘wikibooks’ Error in library(xgboost) : there is no package called ‘xgboost’ Error in library(EloChoice) : there is no package called ‘EloChoice’ Error in library(shinyAce) : there is no package called ‘shinyAce’ Error in library(PubBias) : there is no package called ‘PubBias’ Error in library(ProfessR) : there is no package called ‘ProfessR’ Error in library(gpmap) : there is no package called ‘gpmap’ Error in library(fracdiff) : there is no package called ‘fracdiff’ Error in library(paran) : there is no package called ‘paran’ Error in library(rjags) : there is no package called ‘rjags’ Error in library(gazepath) : there is no package called ‘gazepath’ Error in library(jomo) : there is no package called ‘jomo’ Error in library(caret) : there is no package called ‘caret’ Error in library(smcUtils) : there is no package called ‘smcUtils’ Error in library(pdmod) : there is no package called ‘pdmod’ Error in library(LCAextend) : there is no package called ‘LCAextend’ Error in library(qcr) : there is no package called ‘qcr’ Error in library(boxr) : there is no package called ‘boxr’ Error in library(optCluster) : there is no package called ‘optCluster’ Error in library(srd) : there is no package called ‘srd’ Error in library(Deducer) : there is no package called ‘Deducer’ Error in library(dendsort) : there is no package called ‘dendsort’ Error in library(dlmap) : there is no package called ‘dlmap’ in y(KernSmoothIRT) : there package called moothIRT’ in library(rspa) : there package called ‘rspa’ in library(dse) : there is kage called ‘dse’ in library(emdist) : there package called ‘emdist’ in library(data.tree) : is no package called tree’ in y(UScensus2000cdp) : there package called sus2000cdp’ in library(superMDS) : is no package called MDS’ in library(PROFANCY) : is no package called NCY’ in y(CrypticIBDcheck) : there package called icIBDcheck’ in library(FREGAT) : there package called ‘FREGAT’ in library(probemod) : is no package called mod’ in library(gitter) : there package called ‘gitter’ in library(phangorn) : is no package called orn’ in library(NormPsy) : is no package called sy’ in library(gRbase) : there package called ‘gRbase’ in library(gRapHD) : there package called ‘gRapHD’ in library(redcapAPI) : is no package called pAPI’ in library(Quandl) : there package called ‘Quandl’ in library(sprinter) : is no package called ter’ in library(cytoDiv) : is no package called iv’ in library(rchess) : there package called ‘rchess’ in library(BioStatR) : is no package called atR’ in library(lsbclust) : is no package called ust’ in library(tmvnsim) : is no package called im’ in y(Segmentor3IsBack) : is no package called ntor3IsBack’ in library(rrBLUP) : there package called ‘rrBLUP’ in library(Sofi) : there package called ‘Sofi’ in library(RANKS) : there package called ‘RANKS’ in library(entropart) : is no package called is no package called ‘datacheck’ Error in library(MNM) : there is no package called ‘MNM’ Error in library(VBmix) : there is no package called ‘VBmix’ Error in library(FCMapper) : there is no package called ‘FCMapper’ Error in library(ParentOffspring) : there is no package called ‘ParentOffspring’ Error in library(LRcontrast) : there is no package called ‘LRcontrast’ Error in library(PabonLasso) : there is no package called ‘PabonLasso’ Error in library(cna) : there is no package called ‘cna’ Error in library(CALF) : there is no package called ‘CALF’ Error in library(RcmdrPlugin.MA) : there is no package called ‘RcmdrPlugin.MA’ Error in library(crimCV) : there is no package called ‘crimCV’ Error in library(SAPP) : there is no package called ‘SAPP’ Error in library(pystr) : there is no package called ‘pystr’ Error in library(oc) : there is no package called ‘oc’ Error in library(GAMBoost) : there is no package called ‘GAMBoost’ Error in library(bisectr) : there is no package called ‘bisectr’ Error in library(bodenmiller) : there is no package called ‘bodenmiller’ Error in library(SoftClustering) : there is no package called ‘SoftClustering’ Error in library(fptdApprox) : there is no package called ‘fptdApprox’ Error in library(choroplethrMaps) : there is no package called ‘choroplethrMaps’ Error in library(elec.strat) : there is no package called ‘elec.strat’ Error in library(RTextureMetrics) : there is no package called ‘RTextureMetrics’ Error in library(gensemble) : there is no package called ‘gensemble’ Error in library(inarmix) : there is no package called ‘inarmix’ Error in library(rvgtest) : there is no package called ‘rvgtest’ Error in library(svKomodo) : there is no package called ‘svKomodo’ Error in library(twitteR) : there is no package called ‘twitteR’ Error in library(spcosa) : there is no package called ‘spcosa’ Error in library(qtutils) : there is no package called ‘qtutils’ Error in library(informR) : there is no package called ‘informR’ Error in library(mousetrack) : there is no package called ‘mousetrack’ Error in library(GMCM) : there is no package called ‘GMCM’ Error in library(NetComp) : there is no package called ‘NetComp’ Error in library(linERR) : there is no package called ‘linERR’ Error in library(gnm) : there is no package called ‘gnm’ Error in library(robeth) : there is no package called ‘robeth’ Error in library(bootRes) : there is no package called ‘tidyr’ Error in library(mosaicData) : there is no package called ‘mosaicData’ Error in library(PogromcyDanych) : there is no package called ‘PogromcyDanych’ Error in library(SeleMix) : there is no package called ‘SeleMix’ Error in library(flacco) : there is no package called ‘flacco’ Error in library(ngspatial) : there is no package called ‘ngspatial’ Error in library(wpp2015) : there is no package called ‘wpp2015’ Error in library(groupRemMap) : there is no package called ‘groupRemMap’ Error in library(ETAS) : there is no package called ‘ETAS’ Error in library(bmrm) : there is no package called ‘bmrm’ Error in library(pegas) : there is no package called ‘pegas’ Error in library(pragma) : there is no package called ‘pragma’ Error in library(robCompositions) : there is no package called ‘robCompositions’ Error in library(jmuOutlier) : there is no package called ‘jmuOutlier’ Error in library(customizedTraining) : there is no package called ‘customizedTraining’ Error in library(DCODE) : there is no package called ‘DCODE’ Error in library(VertexSimilarity) : there is no package called ‘VertexSimilarity’ Error in library(validate) : there is no package called ‘validate’ Error in library(splusTimeDate) : there is no package called ‘splusTimeDate’ Error in library(multivator) : there is no package called ‘multivator’ Error in library(colorhcplot) : there is no package called ‘colorhcplot’ Error in library(pocrm) : there is no package called ‘pocrm’ Error in library(mlxR) : there is no package called ‘mlxR’ Error in library(SpeciesMix) : there is no package called ‘SpeciesMix’ Error in library(JacobiEigen) : there is no package called ‘JacobiEigen’ Error in library(PoweR) : there is no package called ‘PoweR’ Error in library(aqp) : there is no package called ‘aqp’ Error in library(Weighted.Desc.Stat) : there is no package called ‘Weighted.Desc.Stat’ Error in library(biogas) : there is no package called ‘biogas’ Error in library(SGP) : there is no package called ‘SGP’ Error in library(PoisNonNor) : there is no package called ‘PoisNonNor’ Error in library(readr) : there is no package called ‘readr’ Error in library(simctest) : there is no package called ‘simctest’ Error in library(rationalfun) : there is no package called ‘rationalfun’ Error in library(SEMID) : there is no package called ‘SEMID’ Error in library(heatex) : there is no package called ‘heatex’ Error in library(wPerm) : there is no package called ‘wPerm’ Error in library(rstpm2) : there is no package called ‘rstpm2’ Error in library(safeBinaryRegression) : there is no package called ‘safeBinaryRegression’ Error in library(rich) : there is no package called ‘rich’ Error in library(gcbd) : there is no package called ‘gcbd’ Error in library(gvcm.cat) : there is no package called ‘gvcm.cat’ Error in library(wgaim) : there is no package called ‘wgaim’ Error in library(YPmodel) : there is no package called ‘YPmodel’ Error in library(emme2) : there is no package called ‘emme2’ Error in library(nFactors) : there is no package called ‘nFactors’ Error in library(RVideoPoker) : there is no package called ‘RVideoPoker’ Error in library(mgraph) : there is no package called ‘mgraph’ Error in library(SemiCompRisks) : there is no package called ‘SemiCompRisks’ Error in library(HTSCluster) : there is no package called ‘HTSCluster’ Error in library(kselection) : there is no package called ‘kselection’ Error in library(Tides) : there is no package called ‘Tides’ Error in library(selfingTree) : there is no package called ‘selfingTree’ Error in library(Oncotree) : there is no package called ‘Oncotree’ Error in library(ECctmc) : there is no package called ‘ECctmc’ Error in library(SetMethods) : there is no package called ‘SetMethods’ Error in library(np) : there is no package called ‘np’ Error in library(GCPM) : there is no package called ‘GCPM’ Error in library(FField) : there there is no package called ‘forensim’ Error in library(BlockMessage) : there is no package called ‘BlockMessage’ Error in library(semdiag) : there is no package called ‘semdiag’ Error in library(cartography) : there is no package called ‘cartography’ Error in library(semsfa) : there is no package called ‘semsfa’ Error in library(tis) : there is no package called ‘tis’ Error in library(dpglasso) : there is no package called ‘dpglasso’ Error in library(NPC) : there is no package called ‘NPC’ Error in library(orclus) : there is no package called ‘orclus’ Error in library(RESS) : there is no package called ‘RESS’ Error in library(EpiBayes) : there is no package called ‘EpiBayes’ Error in library(plot3D) : there is no package called ‘plot3D’ Error in library(bios2mds) : there is no package called ‘bios2mds’ Error in library(CpGFilter) : there is no package called ‘CpGFilter’ Error in library(MiRSEA) : there is no package called ‘MiRSEA’ Error in library(psData) : there is no package called ‘psData’ Error in library(BSGW) : there is no package called ‘BSGW’ Error in library(fAssets) : there is no package called ‘fAssets’ Error in library(GetTDData) : there is no package called ‘GetTDData’ Error in library(fgac) : there is no package called ‘fgac’ Error in library(steadyICA) : there is no package called ‘steadyICA’ Error in library(gdistance) : there is no package called ‘gdistance’ Error in library(surveyplanning) : there is no package called ‘surveyplanning’ Error in library(QualInt) : there is no package called ‘QualInt’ Error in library(hybridModels) : there is no package called ‘hybridModels’ Error in library(qPCR.CT) : there is no package called ‘qPCR.CT’ Error in library(sejmRP) : there is no package called ‘sejmRP’ Error in library(datapack) : there is no package called ‘datapack’ Error in library(batteryreduction) : there is no package called ‘batteryreduction’ Error in Error in library(TraMineR) : there is no package called ‘TraMineR’ Error in library(saeSim) : there is no package called ‘saeSim’ Error in library(NPsimex) : there is no package called ‘NPsimex’ Error in library(BEDMatrix) : there is no package called ‘BEDMatrix’ Error in library(GEVStableGarch) : there is no package called ‘GEVStableGarch’ Error in library(forensim) : there is no package called ‘forensim’ Error in library(BlockMessage) : there is no package called ‘BlockMessage’ Error in library(semdiag) : there is no package called ‘semdiag’ Error in library(cartography) : there is no package called ‘cartography’ Error in library(semsfa) : there is no package called ‘semsfa’ Error in library(tis) : there is no package called ‘tis’ Error in library(dpglasso) : there is no package called ‘dpglasso’ Error in library(NPC) : there is no package called ‘NPC’ Error in library(orclus) : there is no package called ‘orclus’ Error in library(RESS) : there is no package called ‘RESS’ Error in library(EpiBayes) : there is no package called ‘EpiBayes’ Error in library(plot3D) : there is no package called ‘plot3D’ Error in library(bios2mds) : there is no package called ‘bios2mds’ Error in library(CpGFilter) : there is no package called ‘CpGFilter’ Error in library(MiRSEA) : there is no package called ‘MiRSEA’ Error in library(psData) : there is no package called ‘psData’ Error in library(BSGW) : there is no package called ‘BSGW’ Error in library(fAssets) : there is no package called ‘fAssets’ Error in library(GetTDData) : there is no package called ‘GetTDData’ Error in library(fgac) : there is no package called ‘fgac’ Error in library(steadyICA) : there is no package called ‘steadyICA’ Error in library(gdistance) : there is no package called ‘gdistance’ Error in library(surveyplanning) : there is no package called ‘surveyplanning’ Error in library(QualInt) : there is no package called ‘QualInt’ Error in library(hybridModels) : Error in library(password) : there is no package called ‘password’ Error in library(profileModel) : there is no package called ‘profileModel’ Error in library(qrjoint) : there is no package called ‘qrjoint’ Error in library(compound.Cox) : there is no package called ‘compound.Cox’ Error in library(GlobalFit) : there is no package called ‘GlobalFit’ Error in library(MCI) : there is no package called ‘MCI’ Error in library(cvAUC) : there is no package called ‘cvAUC’ Error in library(stima) : there is no package called ‘stima’ Error in library(hypergea) : there is no package called ‘hypergea’ Error in library(eqs2lavaan) : there is no package called ‘eqs2lavaan’ Error in library(Demerelate) : there is no package called ‘Demerelate’ Error in library(varComp) : there is no package called ‘varComp’ Error in library(radarchart) : there is no package called ‘radarchart’ Error in library(ssfa) : there is no package called ‘ssfa’ Error in library(tgram) : there is no package called ‘tgram’ Error in library(snpEnrichment) : there is no package called ‘snpEnrichment’ Error in library(gWidgets2RGtk2) : there is no package called ‘gWidgets2RGtk2’ Error in library(DeducerPlugInScaling) : there is no package called ‘DeducerPlugInScaling’ Error in library(elmNN) : there is no package called ‘elmNN’ Error in library(fslr) : there is no package called ‘fslr’ Error in library(SemiParSampleSel) : there is no package called ‘SemiParSampleSel’ Error in library(leiv) : there is no package called ‘leiv’ Error in library(datacheck) : there is no package called ‘datacheck’ Error in library(MNM) : there is no package called ‘MNM’ Error in library(VBmix) : there is no package called ‘VBmix’ Error in library(FCMapper) : there is no package called ‘FCMapper’ Error in library(ParentOffspring) : there is no package called ‘ParentOffspring’ Error in library(LRcontrast) : there is no package called there is no package called ‘ngspatial’ Error in library(wpp2015) : there is no package called ‘wpp2015’ Error in library(groupRemMap) : there is no package called ‘groupRemMap’ Error in library(ETAS) : there is no package called ‘ETAS’ Error in library(bmrm) : there is no package called ‘bmrm’ Error in library(pegas) : there is no package called ‘pegas’ Error in library(pragma) : there is no package called ‘pragma’ Error in library(robCompositions) : there is no package called ‘robCompositions’ Error in library(jmuOutlier) : there is no package called ‘jmuOutlier’ Error in library(customizedTraining) : there is no package called ‘customizedTraining’ Error in library(DCODE) : there is no package called ‘DCODE’ Error in library(VertexSimilarity) : there is no package called ‘VertexSimilarity’ Error in library(validate) : there is no package called ‘validate’ Error in library(splusTimeDate) : there is no package called ‘splusTimeDate’ Error in library(multivator) : there is no package called ‘multivator’ Error in library(colorhcplot) : there is no package called ‘colorhcplot’ Error in library(pocrm) : there is no package called ‘pocrm’ Error in library(mlxR) : there is no package called ‘mlxR’ Error in library(SpeciesMix) : there is no package called ‘SpeciesMix’ Error in library(JacobiEigen) : there is no package called ‘JacobiEigen’ Error in library(PoweR) : there is no package called ‘PoweR’ Error in library(aqp) : there is no package called ‘aqp’ Error in library(Weighted.Desc.Stat) : there is no package called ‘Weighted.Desc.Stat’ Error in library(multisensi) : there is no package called ‘multisensi’ Error in library(guess) : there is no package called ‘guess’ Error in library(mateable) : there is no package called ‘mateable’ Error in library(httk) : there is no package called ‘httk’ Error in library(wrspathrowData) : there is no package called ‘wrspathrowData’ is no package called ‘gitter’ Error in library(phangorn) : there is no package called ‘phangorn’ Error in library(NormPsy) : there is no package called ‘NormPsy’ Error in library(gRbase) : there is no package called ‘gRbase’ Error in library(gRapHD) : there is no package called ‘gRapHD’ Error in library(redcapAPI) : there is no package called ‘redcapAPI’ Error in library(Quandl) : there is no package called ‘Quandl’ Error in library(sprinter) : there is no package called ‘sprinter’ Error in library(cytoDiv) : there is no package called ‘cytoDiv’ Error in library(rchess) : there is no package called ‘rchess’ Error in library(BioStatR) : there is no package called ‘BioStatR’ Error in library(lsbclust) : there is no package called ‘lsbclust’ Error in library(tmvnsim) : there is no package called ‘tmvnsim’ Error in library(Segmentor3IsBack) : there is no package called ‘Segmentor3IsBack’ Error in library(rrBLUP) : there is no package called ‘rrBLUP’ Error in library(Sofi) : there is no package called ‘Sofi’ Error in library(RANKS) : there is no package called ‘RANKS’ Error in library(entropart) : there is no package called ‘entropart’ Error in library(ipw) : there is no package called ‘ipw’ Error in library(netgen) : there is no package called ‘netgen’ Error in library(orca) : there is no package called ‘orca’ Error in library(VBLPCM) : there is no package called ‘VBLPCM’ Error in library(DCluster) : there is no package called ‘DCluster’ Error in library(dcemriS4) : there is no package called ‘dcemriS4’ Error in library(Runiversal) : there is no package called ‘Runiversal’ Error in library(gamlss.data) : there is no package called ‘gamlss.data’ Error in library(timetree) : there is no package called ‘timetree’ Error in library(MGLM) : there is no package called ‘MGLM’ Error in library(geoR) : there is no package called ‘geoR’ Error in library(jiebaR) : there is no package called ‘jiebaR’ Error in library(RQuantLib) : there is no package called
  13. 13. needs to the rescue
  14. 14. A simple wrapper around library and install.packages that loads/attaches packages and automatically installs any that are missing
  15. 15. > install.packages("needs") > library(needs) Should `needs` load itself when it’s... needed? (this is recommended) 1: Yes 2: No Selection: 1 Restarting R session... > needs(dplyr) installing packages: dplyr > summarize(mtcars, mean(mpg)) mean(mpg) 1 20.09062
  16. 16. > needs(dplyr, plyr, .printConflicts = T) FUNCTION arrange count desc failwith filter id lag mutate rename summarise summarize LOCATION package:plyr package:plyr package:plyr package:plyr package:dplyr package:plyr package:dplyr package:plyr package:plyr package:plyr package:plyr
  17. 17. > needs(dplyr, plyr) > prioritize(dplyr) > needs(.printConflicts = T) FUNCTION arrange count desc failwith filter id lag mutate rename summarise summarize LOCATION package:dplyr package:dplyr package:dplyr package:dplyr package:dplyr package:dplyr package:dplyr package:dplyr package:dplyr package:dplyr package:dplyr
  18. 18. > library(dplyr) Attaching package: ‘dplyr’ The Following objects are masked from ‘package:stats’: filter, lag The following objects are masked from ‘package:base’: intersect, setdiff, setequal, union > library(plyr) -----------—--------—-------------—--------—-------------—--------—-- You have loaded plyr after dplyr - this is likely to cause problems. If you need functions from both plyr and dplyr, please load plyr first, then dplyr: library(plyr); library(dplyr) -----------—--------—-------------—--------—-------------—--------—-- Attaching package: ‘plyr’ The following objects are masked from ‘package:dplyr’: arrange, count, desc, failwith, id, mutate, rename, summarise, summarize >iris %>% + group_by(Species) %>% + summarize(mean(Sepal.Length)) mean(Sepal.Length) 1 5.84333 > > needs(dplyr, plyr) > prioritize(dplyr) > iris %>% + group_by(Species) %>% + summarize(mean(Sepal.Length)) Source: local data frame [3 x 2] Species mean(Sepal.Length) (fctr) (dbl) 1 setosa 5.006 2 versicolor 5.936 3 virginica 6.588 >
  19. 19. THANKS

×