SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
Using R at NYT Graphics
Josh Katz
Graphics Editor
The New York Times
Text analysis
Spatial smoothing
Correlations
Live election forecasts
Seasonal adjustment
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
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);
});
Using R with Makefiles
What could go wrong?
> source(“r-work/fail.R”)
Error in library(readr) : there is no package called ‘readr’
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
needs to the rescue
A simple wrapper around library and install.packages
that loads/attaches packages and automatically installs
any that are missing
> 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
> 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
> 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
> 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
>
THANKS

Weitere ähnliche Inhalte

Andere mochten auch

Andere mochten auch (14)

Reflection on the Data Science Profession in NYC
Reflection on the Data Science Profession in NYCReflection on the Data Science Profession in NYC
Reflection on the Data Science Profession in NYC
 
Data Science Challenges in Personal Program Analysis
Data Science Challenges in Personal Program AnalysisData Science Challenges in Personal Program Analysis
Data Science Challenges in Personal Program Analysis
 
Improving Data Interoperability for Python and R
Improving Data Interoperability for Python and RImproving Data Interoperability for Python and R
Improving Data Interoperability for Python and R
 
What We Learned Building an R-Python Hybrid Predictive Analytics Pipeline
What We Learned Building an R-Python Hybrid Predictive Analytics PipelineWhat We Learned Building an R-Python Hybrid Predictive Analytics Pipeline
What We Learned Building an R-Python Hybrid Predictive Analytics Pipeline
 
Building Scalable Prediction Services in R
Building Scalable Prediction Services in RBuilding Scalable Prediction Services in R
Building Scalable Prediction Services in R
 
A Statistician Walks into a Tech Company: R at a Rapidly Scaling Healthcare S...
A Statistician Walks into a Tech Company: R at a Rapidly Scaling Healthcare S...A Statistician Walks into a Tech Company: R at a Rapidly Scaling Healthcare S...
A Statistician Walks into a Tech Company: R at a Rapidly Scaling Healthcare S...
 
Dr. Datascience or: How I Learned to Stop Munging and Love Tests
Dr. Datascience or: How I Learned to Stop Munging and Love TestsDr. Datascience or: How I Learned to Stop Munging and Love Tests
Dr. Datascience or: How I Learned to Stop Munging and Love Tests
 
Iterating over statistical models: NCAA tournament edition
Iterating over statistical models: NCAA tournament editionIterating over statistical models: NCAA tournament edition
Iterating over statistical models: NCAA tournament edition
 
Thinking Small About Big Data
Thinking Small About Big DataThinking Small About Big Data
Thinking Small About Big Data
 
Julia + R for Data Science
Julia + R for Data ScienceJulia + R for Data Science
Julia + R for Data Science
 
R for Everything
R for EverythingR for Everything
R for Everything
 
High-Performance Python
High-Performance PythonHigh-Performance Python
High-Performance Python
 
Scaling Data Science at Airbnb
Scaling Data Science at AirbnbScaling Data Science at Airbnb
Scaling Data Science at Airbnb
 
Inside the R Consortium
Inside the R ConsortiumInside the R Consortium
Inside the R Consortium
 

Mehr von Work-Bench

Cloud Native Infrastructure Management Solutions Compared
Cloud Native Infrastructure Management Solutions ComparedCloud Native Infrastructure Management Solutions Compared
Cloud Native Infrastructure Management Solutions Compared
Work-Bench
 

Mehr von Work-Bench (8)

2017 Enterprise Almanac
2017 Enterprise Almanac2017 Enterprise Almanac
2017 Enterprise Almanac
 
AI to Enable Next Generation of People Managers
AI to Enable Next Generation of People ManagersAI to Enable Next Generation of People Managers
AI to Enable Next Generation of People Managers
 
Startup Recruiting Workbook: Sourcing and Interview Process
Startup Recruiting Workbook: Sourcing and Interview ProcessStartup Recruiting Workbook: Sourcing and Interview Process
Startup Recruiting Workbook: Sourcing and Interview Process
 
Cloud Native Infrastructure Management Solutions Compared
Cloud Native Infrastructure Management Solutions ComparedCloud Native Infrastructure Management Solutions Compared
Cloud Native Infrastructure Management Solutions Compared
 
Building a Demand Generation Machine at MongoDB
Building a Demand Generation Machine at MongoDBBuilding a Demand Generation Machine at MongoDB
Building a Demand Generation Machine at MongoDB
 
How to Market Your Startup to the Enterprise
How to Market Your Startup to the EnterpriseHow to Market Your Startup to the Enterprise
How to Market Your Startup to the Enterprise
 
Marketing & Design for the Enterprise
Marketing & Design for the EnterpriseMarketing & Design for the Enterprise
Marketing & Design for the Enterprise
 
Playing the Marketing Long Game
Playing the Marketing Long GamePlaying the Marketing Long Game
Playing the Marketing Long Game
 

Kürzlich hochgeladen

Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
gajnagarg
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
gajnagarg
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Bertram Ludäscher
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
ahmedjiabur940
 
Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1
ranjankumarbehera14
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Klinik kandungan
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
nirzagarg
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
gajnagarg
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
nirzagarg
 
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
HyderabadDolls
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
gajnagarg
 

Kürzlich hochgeladen (20)

Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
 
7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
 
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
 
RESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptx
RESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptxRESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptx
RESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptx
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
 
Fun all Day Call Girls in Jaipur 9332606886 High Profile Call Girls You Ca...
Fun all Day Call Girls in Jaipur   9332606886  High Profile Call Girls You Ca...Fun all Day Call Girls in Jaipur   9332606886  High Profile Call Girls You Ca...
Fun all Day Call Girls in Jaipur 9332606886 High Profile Call Girls You Ca...
 
20240412-SmartCityIndex-2024-Full-Report.pdf
20240412-SmartCityIndex-2024-Full-Report.pdf20240412-SmartCityIndex-2024-Full-Report.pdf
20240412-SmartCityIndex-2024-Full-Report.pdf
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
 

Using R at NYT Graphics

  • 1. Using R at NYT Graphics Josh Katz Graphics Editor The New York Times
  • 2.
  • 3.
  • 9.
  • 10.
  • 11. 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
  • 12. 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); });
  • 13. Using R with Makefiles
  • 14.
  • 15. What could go wrong?
  • 16.
  • 17. > source(“r-work/fail.R”) Error in library(readr) : there is no package called ‘readr’
  • 18. 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
  • 19. needs to the rescue
  • 20. A simple wrapper around library and install.packages that loads/attaches packages and automatically installs any that are missing
  • 21. > 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
  • 22.
  • 23.
  • 24. > 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
  • 25. > 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
  • 26. > 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 >