Comments (4)
How did you build the website? You should not simply run system('hugo')
when you have Rmd posts. You have to use blogdown::build_site()
instead, or publish the public
directory after you call blogdown::serve_site()
.
from blogdown.
I run the serve_site() function and this is what I see locally as well. It has now happened with another page which had been working fine i.e. only accessible if full url is put in and does not appear in recent posts. Also the plot expected to appear no longer does
here is code
---
title: "Hansard"
author: "Andrew Clark"
date: 2016-11-17
categories: ["packages"]
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(collapse = TRUE)
UK 2015 Election
I like to check out new and enhanced R packages, particularly those relating to socio-economic issues and sports
A recent new entry is hansard, which pulls data from the UK Parliament API.
Other required packages, which I will make extensive use of in future code extracts, are tidyverse, for data preparation and processing, and
plotly, for a wide set of interactive graphics
The election_results() function retrieves all the results. It takes about 10 seconds to process so I have saved it in a csv file for retrieval in any future manipulation
library(hansard)
library(plotly)
library(tidyverse)
# This function retrieves all the election results and takes a few seconds and has been saved previously
#election_results <- election_results()
#write_csv(election_results,"data/election_results.csv")
#read the saved file
results <- read_csv("../../data/election_results.csv")
# view data.frame
results
Let's say we were interested in how the size of majority is associated with the level of turnout. It might be hypothesised that those constituencies where a tight race was anticipated would have the highest turn-outs - where every vote might count
# filter out unwanted rows and calculate a couple of percentages
df <- results %>%
filter(election.label._value == "2015 General Election") %>% #650
mutate(
to_pc = round(100 * turnout / electorate, 1),
margin_pc = round(100 * majority / turnout, 1)
)
# plot the data, adding a custom info-action
df %>%
plot_ly(
x = ~ to_pc,
y = ~ margin_pc,
color = ~ resultOfElection,
hoverinfo = "text",
text = ~ paste0(
constituency.label._value,
"<br>",
resultOfElection,
"<br>Turnout:",
to_pc,
"%<br>Margin:",
margin_pc,
"%"
)
) %>%
layout(
title = "2015 UK General Election Winners Margin and Turnout Percentage",
xaxis = list(title = "% Turnout"),
yaxis = list(title = "% Winner Margin")
) %>%
config(displayModeBar = F, showLink = F)
Well maybe.. but for those of you wanting to model it feel free. What is highlighted is the 'wasted' votes in Labour strongholds.
Hover over any point, if desired after selecting and zooming, for more details
There are plenty more functions within the package and the creator, Evan Odell is actively developing it
I'll recreate the posts under another name to see if that helps
from blogdown.
Can I see the source repository of this website? I cannot think of anything only by looking at this single post.
from blogdown.
I had already deleted the files and recreated under another name and am no longer getting this error. If it reappears, I will reopen with screenshots
from blogdown.
Related Issues (20)
- For error `could not find function "parser"`: fail more gracefully HOT 3
- Issue with site formatting with blogdown::build_site(). HOT 3
- Unable to serve site after updates HOT 6
- modelDown::modelDown() deleted all files in my output folder??!! HOT 1
- Home directory does not exist in HUGO academic-theme HOT 1
- Upkeep for blogdown
- Rmd files rendering with formatting issues HOT 7
- blogdown:::new_post_addin() should check for hugo first HOT 1
- Blogdown donβt supports multiple-column rmarkdown HOT 8
- Unable to create new posts HOT 2
- Missing website menu bar buttons when using blogdown to render web pages HOT 3
- Wrong relative links on the pkgdown site HOT 2
- allow use of hugo.toml for config [FR] HOT 3
- Error building site with hugo-apero theme HOT 5
- Build site with updated Hugo HOT 2
- shortcode doesn't display with leaflet map in the same post HOT 4
- Rmd - interactive map with tmap does not display HOT 5
- trialblogdown HOT 1
- Blogdown starting error and rmd render not working HOT 1
- unable to embed Rmd file in html output HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blogdown.