Skip to content

Commit

Permalink
fixing bug in gapminder lab
Browse files Browse the repository at this point in the history
  • Loading branch information
mkierczak committed Nov 16, 2018
1 parent 2a6152a commit ed4e11a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Exercises/Lab_gapminder_ggplot/gapminder.html
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ <h1>The Lab</h1>
url &lt;-<span class="st"> 'https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_by_population'</span>
data &lt;-<span class="st"> </span>url %&gt;%<span class="st"> </span><span class="kw">read_html</span>() %&gt;%<span class="st"> </span><span class="kw">html_nodes</span>(<span class="st">'table'</span>)
pop &lt;-<span class="st"> </span><span class="kw">html_table</span>(data[[<span class="dv">2</span>]], <span class="dt">dec=</span><span class="st">'.'</span>, <span class="dt">header=</span>T)
pop$<span class="st">`</span><span class="dt">Country(or dependent territory)</span><span class="st">`</span> &lt;-<span class="st"> </span><span class="kw">iconv</span>(pop$<span class="st">`</span><span class="dt">Country (or dependent territory)</span><span class="st">`</span>, <span class="st">&quot;UTF-8&quot;</span>, <span class="st">&quot;ascii&quot;</span>,<span class="dt">sub=</span><span class="st">''</span>)
pop$<span class="st">`</span><span class="dt">Country (or dependent territory)</span><span class="st">`</span> &lt;-<span class="st"> </span><span class="kw">iconv</span>(pop$<span class="st">`</span><span class="dt">Country(or dependent territory)</span><span class="st">`</span>, <span class="st">&quot;UTF-8&quot;</span>, <span class="st">&quot;ascii&quot;</span>,<span class="dt">sub=</span><span class="st">''</span>)
<span class="kw">colnames</span>(pop) &lt;-<span class="st"> </span><span class="kw">gsub</span>(<span class="st">'</span><span class="ch">\n</span><span class="st">'</span>, <span class="st">''</span>, <span class="kw">colnames</span>(pop))
<span class="kw">colnames</span>(pop)[<span class="dv">2</span>] &lt;-<span class="st"> 'Country'</span>
pop$Population &lt;-<span class="st"> </span><span class="kw">as.numeric</span>(<span class="kw">gsub</span>(<span class="st">','</span>, <span class="st">''</span>, pop$Population))
Expand Down

0 comments on commit ed4e11a

Please sign in to comment.