August 2017

Why are Racing Drivers Born on March 23

August 31, 2017 | The Clerk

Wikipedia has pages for each day of the year (e.g., January 1, April 25). Each page contains a list of names of famous people with that birthday along with a short description of each person. I wrote an R script to scrape these lists from each wikipedi...
[Read more...]

RcppAnnoy 0.0.9

August 31, 2017 | Thinking inside the box

An new version 0.0.9 of RcppAnnoy, our Rcpp-based R integration of the nifty Annoy library by Erik, is now on CRAN. Annoy is a small and lightweight C++ template header library for very fast approximate nearest neighbours. This release corrects an is... [Read more...]

OpenML Workshop 2017

August 31, 2017 | Giuseppe Casalicchio

What is OpenML? The field of Machine Learning has grown tremendously over the last years, and is a key component of data-driven science. Data analysis algorithms are being invented and used every day, but their results and experiments are published almost exclusively in journals or separated repositories. However, data by ... [Read more...]

Mapping to a ‘t'(map)

August 31, 2017 | HighlandR

tmap More maps of the Highlands? Yep, same as last time, but no need to install dev versions of anything, we can get awesome maps courtesy of the tmap package. Get the shapefile from the last post
<span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="n">tmap</span><span class="p">)</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="n">tmaptools</span><span class="p">)</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="n">viridis</span><span class="p">)</span><span class="w">

</span><span class="n">scot</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">read_shape</span><span class="p">(</span><span class="s2">"SG_SIMD_2016.shp"</span><span class="p">,</span><span class="w"> </span><span class="n">as.sf</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">
</span><span class="n">highland</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="p">(</span><span class="n">scot</span><span class="p">[</span><span class="n">scot</span><span class="o">$</span><span class="n">LAName</span><span class="o">==</span><span class="s2">"Highland"</span><span class="p">,</span><span class="w"> </span><span class="p">])</span><span class="w">


</span><span class="c1">#replicate plot from previous blog post:</span><span class="w">

</span><span class="n">quint</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">tm_shape</span><span class="p">(</span><span class="n">highland</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w">
  </span><span class="n">tm_fill</span><span class="p">(</span><span class="n">col</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"Quintile"</span><span class="p">,</span><span class="w">
          </span><span class="n">palette</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">viridis</span><span class="p">(</span><span class="n">n</span><span class="o">=</span><span class="m">5</span><span class="p">,</span><span class="w"> </span><span class="n">direction</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">-1</span><span class="p">,</span><span class="n">option</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"C"</span><span class="p">),</span><span class="w">
          </span><span class="n">fill.title</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"Quintile"</span><span class="p">,</span><span class="w">
          </span><span class="n">title</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"SIMD 2016 - Highland Council Area by Quintile"</span><span class="p">)</span><span class="w">

</span><span class="n">quint</span><span class="w"> </span><span class="c1"># plot</span><span class="w">

</span><span class="n">ttm</span><span class="p">()</span><span class="w"> </span><span class="c1">#switch between static and interactive - this will use interactive</span><span class="w">
</span><span class="n">quint</span><span class="w"> </span><span class="c1"># or use last_map()</span><span class="w">
</span><span class="c1"># in R Studio you will find leaflet map in your Viewer tab</span><span class="w">

</span><span class="n">ttm</span><span class="p">()</span><span class="w"> </span><span class="c1"># return to plotting</span><span class="w">

</span>
The results: One really nice thing is that because the polygons don’...
[Read more...]

Mapping to a ‘t'(map)

August 31, 2017 | HighlandR

tmap More maps of the Highlands? Yep, same as last time, but no need to install dev versions of anything, we can get awesome maps courtesy of the tmap package. Get the shapefile from the last post
<span class="n">library</span><span class="p">(</span><span class="n">tmap</span><span class="p">)</span>
<span class="n">library</span><span class="p">(</span><span class="n">tmaptools</span><span class="p">)</span>
<span class="n">library</span><span class="p">(</span><span class="n">viridis</span><span class="p">)</span>

<span class="n">scot</span> <span class="o"><-</span> <span class="n">read_shape</span><span class="p">(</span><span class="s2">"SG_SIMD_2016.shp"</span><span class="p">,</span> <span class="n">as.sf</span> <span class="o">=</span> <span class="n">TRUE</span><span class="p">)</span>
<span class="n">highland</span> <span class="o"><-</span> <span class="p">(</span><span class="n">scot</span><span class="p">[</span><span class="n">scot</span><span class="o">$</span><span class="n">LAName</span><span class="o">==</span><span class="s2">"Highland"</span><span class="p">,</span> <span class="p">])</span>


<span class="c1">#replicate plot from previous blog post:
</span>
<span class="n">quint</span> <span class="o"><-</span> <span class="n">tm_shape</span><span class="p">(</span><span class="n">highland</span><span class="p">)</span> <span class="o">+</span>
  <span class="n">tm_fill</span><span class="p">(</span><span class="n">col</span> <span class="o">=</span> <span class="s2">"Quintile"</span><span class="p">,</span>
          <span class="n">palette</span> <span class="o">=</span> <span class="n">viridis</span><span class="p">(</span><span class="n">n</span><span class="o">=</span><span class="m">5</span><span class="p">,</span> <span class="n">direction</span> <span class="o">=</span> <span class="m">-1</span><span class="p">,</span><span class="n">option</span> <span class="o">=</span> <span class="s2">"C"</span><span class="p">),</span>
          <span class="n">fill.title</span> <span class="o">=</span> <span class="s2">"Quintile"</span><span class="p">,</span>
          <span class="n">title</span> <span class="o">=</span> <span class="s2">"SIMD 2016 - Highland Council Area by Quintile"</span><span class="p">)</span>

<span class="n">quint</span> <span class="c1"># plot
</span>
<span class="n">ttm</span><span class="p">()</span> <span class="c1">#switch between static and interactive - this will use interactive
</span><span class="n">quint</span> <span class="c1"># or use last_map()
# in R Studio you will find leaflet map in your Viewer tab
</span>
<span class="n">ttm</span><span class="p">()</span> <span class="c1"># return to plotting
</span>
The results: One really nice thing is that because the polygons don’... [Read more...]

Multiplicative Congruential Generators in R

August 31, 2017 | Aaron Schlegel

Part 2 of 2 in the series Random Number GenerationMultiplicative congruential generators, also known as Lehmer random number generators, is a type of linear congruential generator for generating pseudorandom numbers in . The multiplicative congruential generator, often abbreviated as MLCG or MCG, is defined as a recurrence relation similar to... The post Multiplicative ... [Read more...]

Probability functions intermediate

August 31, 2017 | Francisco Méndez

In this set of exercises, we are going to explore some of the probability functions in R by using practical applications. Basic probability knowledge is required. In case you are not familiarized with the function apply, check the R documentation. Note: We are going to use random numbers functions and ... [Read more...]

Text featurization with the Microsoft ML package

August 31, 2017 | David Smith

Last week I wrote about how you can use the MicrosoftML package in Microsoft R to featurize images: reduce an image to a vector of 4096 numbers that quantify the essential characteristics of the image, according to an AI vision model. You can perform a similar featurization process with text as ... [Read more...]

Why to use the replyr R package

August 31, 2017 | John Mount

Recently I noticed that the R package sparklyr had the following odd behavior: suppressPackageStartupMessages(library("dplyr")) library("sparklyr") packageVersion("dplyr") #__ [1] '0.7.2.9000' packageVersion("sparklyr") #__ [1] '0.6.2' packageVersion("dbplyr") #__ [1] '1.1.0.9000' sc * Using Spark: 2.1.0 d [1] NA ncol(d) #__ [1] NA nrow(d) #__ [1] NA … Continue reading Why to use the replyr R package
[Read more...]

Pulling Data Out of Census Spreadsheets Using R

August 31, 2017 | Margot Tollefson

In this post, I show a method for extracting small amounts of data from somewhat large Census Bureau Excel spreadsheets, using R.  The objects of interest are expenditures of state and local governments on hospital capital in Iowa for the years 2004 to 2014. The data can be found at http://www2.... [Read more...]

Pacific Island Hopping using R and iGraph

August 30, 2017 | Peter Prevos

Use R as your travel guide and plan your next Pacific island hopping holiday with the igraph package. This code analyses flight routes and finds routes. Continue reading → The post Pacific Island Hopping using R and iGraph appeared first on The Devil is in the Data.
[Read more...]

Pacific Island Hopping using R and iGraph

August 30, 2017 | Peter Prevos

Use R as your travel guide and plan your next Pacific island hopping holiday with the igraph package. This code analyses flight routes and finds routes. Continue reading → The post Pacific Island Hopping using R and iGraph appeared first on The Devil is in the Data.
[Read more...]

Project management for scalable data analysis

August 30, 2017 | R on francojc ⟲

Project management This post can really be seen as an extension of the last post Getting started with R and RStudio in that we will be getting to know some more advanced, but indispensable features of RStudio. These features, in combination with some organizational and programming strategies, will enable us ...
[Read more...]

Finding distinct rows of a tibble

August 30, 2017 | R on Rob J Hyndman

I’ve been using R or its predecessors for about 30 years, so I tend to I know a lot about R, but I don’t necessarily know how to use modern R tools. Lately, I’ve been teaching my students the tidyverse approach to data analysis, which means that I ... [Read more...]
1 2 3 17

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)