Publications by Kay Cichini
Reproducible Research: Export Regression Table to MS Word
Here’s a quick tip for anyone wishing to export results, say a regression table, from R to MS Word:require(R2wd) # install packages required # install software RCOM, RDCOMClient # (I had to restart the R-Session after the above step to get it work) wdGet() # Regression: data(iris) mod <- lm(Sepal.Length ~ Species, data = iris) regr_tab <- d...
565 sym R (686 sym/1 pcs) 2 img
Reproducible Research: Running odfWeave with 7-zip
odfWeave is an R-package that is used for making dynamic reports by Sweave processing of Open Document Format (ODF) files. For anyone new to report generation and lacking knowledge of markup languages this might be a good starting point or even a true alternative to sweave / LATEX and others.Now, anyone who recently tried to install t...
1405 sym R (3160 sym/1 pcs)
Quick Tip: Replace Values in Dataframe on Condition with Random Numbers
This one took me some time – though, in fact it is plain simple:> options(scipen=999) > (my_df <- data.frame(matrix(sample(c(0,1), 100, replace = T), 10, 10))) X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 1 0 0 1 0 1 1 1 1 0 1 2 0 0 1 1 1 0 0 0 0 0 3 0 1 1 0 0 1 1 0 0 1 4 1 1 0 0 0 0 0 0 0 0 5 ...
472 sym R (1589 sym/1 pcs)
Playing with knitr: Create Report with Dynamic List
Here is a little toy example using knitr, LaTeX/MiKTeX and Google Docs.Say you had a list on Google Docs (say a list of attendants) and you want to print a report with it..Then see this example using this Rnw-file and the output…make the tex-file with:library(knitr) knit("knitr_list_of_attendants.Rnw") ..then compile the tex-file wi...
722 sym R (136 sym/2 pcs) 2 img
knitr-Example: Use World Bank Data to Generate Report for Threatened Bird Species
I’ll use the below script that retrieves data for threatened bird species from the World Bank via its API and does some processing, plotting and analysis. There is a package (WDI) that allows you to access the data easily.# world bank indicators for species - # I'll check bird species: code <- as.character(WDIsearch("bird")[1,1]) bird_data <- ...
931 sym R (1588 sym/3 pcs) 2 img
Source R-Script from Dropbox
A quick tip on how to source R-scripts from a Dropbox-account:(1) Upload the script.. (2) Get link with the “get link” option. The link should look like “https://www.dropbox.com/s/XXXXXX/yourscript.R”..(3) Grab this part “XXXXXX/yourscript.R” and paste it to “http://dl.dropbox.com/s/”..(4) the final URL that can be sourced:source(...
876 sym R (434 sym/3 pcs) 2 img
FloraWeb Plant Species Report via R
For German-spoken users I added the function floraweb_scrape.R that allows you to conveniently collect species data and print to a PDF-file (see this example output). The function accesses data provided by the web-site FloraWeb.de (BfN – Bundesministerium für Naturschutz).You can use it as an interactive version (RTclTk) which I ...
787 sym 2 img
A Wrapper Function for Instant Package Installation / Loading
Since library() and require() only accept input with length(input) = 1 it is necessary to make repeated calls – this can be quite annoying.. So, HERE is a little wrapper function for convenient package installation / loading. It installs packages if they are missing and loads them if there were not loaded yet. I have put it to my RP...
851 sym
Avoid Overplotting of Text in Ordination Diagram
Referring to a recent posting on r-sig-eco mailing list I’ll add this example to theBioBucket:library(vegan) library(vegan) data(dune) sol <- metaMDS(dune) # use ordipointlabel - # here is an example where I added cex according to species frequencies: plot(sol, type = "n") cex.lab = colSums(dune > 0) / nrow(dune) + 1 col.lab = rgb(0.2, 0.5, 0....
490 sym R (632 sym/1 pcs) 2 img
Use IUCN API with R & XPath
Thanks to a posting on R-sig-eco mailing list I learned of the IUCN-API. Here’s a simple example for what can be done with it (output as pdf is HERE):require(XML) require(maptools) require(jpeg) input = "panthera-uncia" h <- htmlParse(paste("http://api.iucnredlist.org/go/", input, sep = "")) distr1 <- xpathSApply(h, '//ul[@clas...
579 sym R (1348 sym/1 pcs) 2 img