Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PROD Sweave Report Demo
strand = "Open educational resources programme"
\title{CETIS PROD Demonstration Report: \Sexpr{strand}}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In nec dui eget sapien aliquet aliquet. Praesent tincidunt ultrices rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus id nisi sed justo tempor bibendum. Curabitur non velit purus, sit amet fermentum nunc. Vestibulum mattis cursus libero, et scelerisque nulla vulputate non. Phasellus lectus metus, fermentum sit amet suscipit eget, faucibus ac velit. Duis id velit ut purus viverra commodo at sed ligula. Ut lectus felis, ornare id lobortis eget, rutrum sed magna.
\section{Programme Overview}
projects <- read.csv(textConnection(getURL("")), header = T)
projectSub <- subset(projects, grepl("^Open education", projects$Strand ))
# this bit from
# note if you are pulling in multiple columns you may needd to change which one
# in the dataset is select e.g. dataset[,2] etc
ap.corpus <- Corpus(DataframeSource(data.frame(as.character(projectSub$Desc))))
ap.corpus <- tm_map(ap.corpus, removePunctuation)
ap.corpus <- tm_map(ap.corpus, tolower)
ap.corpus <- tm_map(ap.corpus, function(x) removeWords(x, stopwords("english")))
# additional stopwords can be used as shown below
#ap.corpus <- tm_map(ap.corpus, function(x) removeWords(x, c("ukoer","oer")))
ap.tdm <- TermDocumentMatrix(ap.corpus)
ap.m <- as.matrix(ap.tdm)
ap.v <- sort(rowSums(ap.m),decreasing=TRUE)
ap.d <- data.frame(word = names(ap.v),freq=ap.v)
pal2 <- brewer.pal(8,"Dark2")
\caption{Wordcloud of project descriptions}
wordcloud(ap.d$word,ap.d$freq, scale=c(8,.2),min.freq=3, max.words=Inf, random.order=FALSE, rot.per=.15, colors=pal2)
There are \Sexpr{nrow(projectSub)} projects in the \Sexpr{strand} Strand.
\subsection{Project Relationship}
Here is a grpah (see Figure \ref{fig:buildson}) of how projects in this strand relate to other projects
buildson <- read.csv(textConnection(getURL("")), header = T)
g <-, directed=TRUE)
V(g)$size <- degree(g) * 2 # multiply by 2 for scale
l <- layout.fruchterman.reingold(g)
l <- layout.norm(l, -1,1, -1,1)
\caption{Project - builds on}
plot(g, layout=l, vertex.size=3, vertex.label=V(g)$name,
vertex.color="#ff0000", vertex.frame.color="#ff0000", edge.color="#555555",
vertex.label.dist=0, vertex.label.cex=1, vertex.label.font=2,
edge.arrow.size=0.3, xlim=range(l[,1]), ylim=range(l[,2]),
main="Builds on")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment