Publications by Kay Cichini
Default Convenience Functions in R (Rprofile.site)
I keep my blog-reference-functions, snippets, etc., at github and want to source them from there. This can be achieved by utilizing a function (source_https, customized for my purpose HERE). The original function was provided by the R-Blogger Tony Breyal – thanks Tony! As I will use this function quite frequently I just added the function code ...
903 sym 4 img
Some Fun with googleVis – Mapping Blog Visits on Google Map
See stand-alone code to produce this map below.Read more » Related To leave a comment for the author, please follow the link and comment on their blog: theBioBucket*. R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job...
454 sym 4 img
Conversion of Several Variables to Factors
..often needed when preparing data for analysis (and usually forgotten until I need it for the next time).With the below code I convert a set of variables to factors – it could be that there are slicker ways to do it (if you know one let me know!) > dat <- data.frame(matrix(sample(1:40), 4, 10, dimnames = list(1:4, LETTERS[1:10]))) ...
656 sym R (663 sym/1 pcs) 2 img
Function to Collect Geographic Coordinates for IP-Addresses
I added the function IPtoXY to theBioBucket-Archives which collects geographic coordinates for IP-addresses.It uses a web-service at http://www.datasciencetoolkit.org// and works with the base R-packages. # System time to collect coordinates of 100 IP-addresses:> system.time(sapply(log$IP.Address[1:100], FUN = IPtoXY)) User ...
788 sym 4 img
Blog Statistics with StatCounter & R
If you’re interested in analysing your blog’s statistics this can easily be done with a web-service like StatCounter (free, only registration needed, quite extensive service) and with R.After implementing the StatCounter script in the html code of a webpage or blog one can download and inspect log-files with R with some short line...
798 sym R (2217 sym/1 pcs) 2 img
R-Function to Source all Functions from a GitHub Repository
Here’s a function that sources all scripts from an arbitrary github-repository. At the moment the function downloads the whole repo and sources functions kept in a folder named “Functions” – this may be adapted for everyones own purpose.# Script name: fun_install_github.R # Purpose: Source all functions from a GitHub repo # Author: Kay Ci...
633 sym R (1621 sym/1 pcs) 4 img
osmar – Don’t Miss this New R-Geo-Package!
The osmar-package enables you to retrieve all geographic elements of OpenStreetMap via its API.I.e., you can retrieve a street, river, state-boundary or whatever and use this as a spatial object in R.It’s overwhelming thinking of the endless playground that is opened for R-users by this package!And, owing to altruistic R-package authors (like ...
857 sym 4 img
A Short Example with R-Package osmar..
Following up my last post in which I praised the capabilities of the osmar-package I give a short example…ps: You can also find this example at GitHub HERE.library(osmar) # this pulls the data from the OSM-Api: mydistrict <- get_osm(relation(85647), full = TRUE) # make a spatial object: mydistrict_sp <- as_sp(mydistrict, what = 'lines') summa...
552 sym R (1393 sym/1 pcs) 4 img
Transformation of Several Variables in a Dataframe
This is how I transform several columns of a dataframe, i.e., with count-data into binary coded data (this would apply also for any other conversion..).count1 <- count2 <- count3 <- count4 <- sample(c(rep(0, 10), 1:10)) some <- LETTERS[1:20] thing <- letters[1:20] mydf <- data.frame(count1, count2, count3, count4, some, thing) id...
607 sym R (301 sym/1 pcs) 2 img
Testing the Effect of a Factor within each Level of another Factor with R-Package {contrast}
This is a small example of how custom contrasts can easily be applied with the contrast-package. The package-manual has several useful explanations and the below example was actually grabbed from there.This example can also be applied to a GLM but I choose to use a LM because the coefficients are more easily interpreted.set.seed(3) dat <- data.f...
718 sym R (1227 sym/1 pcs) 4 img