Tuesday, 29 November 2016

Finding a place on a graphic....

use:

pos2 <- locator()

See: http://stackoverflow.com/questions/19167586/add-text-on-heatmap-using-locator

Tuesday, 22 November 2016

Things I'm learning at user group

The magick package: Advanced Image-Processing in R
magick
https://cran.r-project.org/web/packages/magick/vignettes/intro.html



broom: a package for tidying statistical models into data frames
https://www.r-bloggers.com/broom-a-package-for-tidying-statistical-models-into-data-frames/

Wednesday, 13 July 2016

Breakthrough on making multiple PDFs....

Using this link: http://www.reed.edu/data-at-reed/software/R/markdown_multiple_reports.html

 I managed to write the R script and the RMarkdown Files that enable multiple PDF files to be made.

I did also have to download the Latex Reader mactex as per the instructions here:
http://www.reed.edu/data-at-reed/software/R/r_studio.html
https://tug.org/mactex/mactex-download.html

Then I had to install, turn off R-Studio and turn it back on again.
It worked well.

To make it work requires an R script with the loop in it.
The loop calls the a Rmarkdown file which writes the PDF.

Here is some of the code:

R-File:   ---  START ---
setwd("/Users/paulbrennan/Dropbox/Teaching/SSC/Admin/")

library(knitr)
library(readxl)

data <- read_excel("results-for-year-3-ssc-as-2016-07-12-1525.xlsx")

# for each student number in the dataframe create a report
# these reports are saved in output_dir with the name specified by output_file
for (x in 1:3){  
  #for pdf reports  
     rmarkdown::render(input = "/Users/paulbrennan/Dropbox/Teaching/SSC/Admin/SSCYr3ReportsfromExcel_5.Rmd", 
             output_format = "pdf_document",
             output_file = paste(data[x,3], "_Year3_SSC_Feedback", ".pdf", sep=''),
             output_dir = "/Users/paulbrennan/Dropbox/Teaching/SSC/Admin/")
  
}
R File:   ---  END ---

Rmd File:   ---  START ---

---
title: "Year 3 SSC Feedback Report"
output: pdf_document
---

```{r, include=FALSE, echo=FALSE}
# create reports on students from an Excel spreadsheet. 
library(readxl)
library(knitr)
library(pander)
setwd("/Users/paulbrennan/Dropbox/Teaching/SSC/Admin/")
# read in the excel file

data <- read_excel("results-for-year-3-ssc-as-2016-07-12-1525.xlsx")

n <- data[x,2]
res <- data[x,4]
```

## STUDENT ID NUMBER:  `r n`
## OVERALL RESULT: `r res`

## Content
```{r, echo=FALSE, results='asis'} 

 names <- c("Content", "Research", "Grammar", "Style & presentation",
           "Comprehension")
 output <- as.character(data[x,6:10])
 output2.df <- cbind(names, output)
 colnames(output2.df) <- c("Content Domain", "Performance Zone")
 pander(output2.df)


## Strengths
```{r, echo=FALSE, results='asis'}
cat(data[x,17])
```

Rmd File:   ---  END ---


N.B. The output is all black and white which is a bit boring but hey...
Also I would like to add a logo but I can't position it very well.
I may have to used Latex or some such:
http://stackoverflow.com/questions/16626462/figure-position-in-markdown-when-converting-to-pdf-with-knitr-and-pandoc

more info here:
http://galahad.well.ox.ac.uk/repro/

Thursday, 26 May 2016

Large files on Git

I just got this error:


GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.        
Trace: 5eb56947e6c5b48544f742090a1ca396        
See http://git.io/iEPt8g for more information.        

File data/images/imageSeq.zip is 104.23 MB; this exceeds GitHub's file size limit of 100.00 MB