background preloader

Impatient R

Impatient R
Translations français: Translated by Kate Bondareva. Serbo-Croatian: Translated by Jovana Milutinovich from Geeks Education. Preface This is a tutorial (previously known as “Some hints for the R beginner”) for beginning to learn the R programming language. It is a tree of pages — move through the pages in whatever way best suits your style of learning. You are probably impatient to learn R — most people are. This page has several sections, they can be put into the four categories: General, Objects, Actions, Help. General Introduction Blank screen syndrome Misconceptions because of a previous language Helpful computer environments R vocabulary Epilogue Objects Key objects Reading data into R Seeing objects Saving objects Magic functions, magic objects Some file types Packages Actions What happens at R startup Key actions Errors and such Graphics Vectorization Make mistakes on purpose

Memory One of the most vexing issues in R is memory. For anyone who works with large datasets - even if you have 64-bit R running and lots (e.g., 18Gb) of RAM, memory can still confound, frustrate, and stymie even experienced R users. I am putting this page together for two purposes. First, it is for myself - I am sick and tired of forgetting memory issues in R, and so this is a repository for all I learn. However, this is a work in progress! 1) Read R> ?" 2) As I said elsewhere, 64-bit computing and a 64-bit version of R are indispensable for working with large datasets (you're capped at ~ 3.5 Gb RAM with 32 bit computing). How to avoid this problem? If you're unwilling to do any of the above, the final option is to read in only the part of the matrix you need, work with that portion of it, and then remove it from memory. 3) It is helpful to constantly keeping an eye on the top unix function (not sure what the equivalent is in windoze) to check the RAM your R session is taking.

Tutorials - Data-gov Wiki From Data-gov Wiki Learn how to build your own linked data demos! This page describes the techniques and technologies used on this wiki, as well as providing links to a number of other tutorials and presentations on these technologies at other sites. Tutorials How-Tos (total 15) Data-gov Insights (total 7) External Resources Weblogs (total 20) Technologies (total 65) Applications (total 4) Other Resources (total 4)

How to calculate polygon centroids in R (for non-contiguous shapes) I've spent a little while figuring out the answer to this question. It's not immediately obvious from a Google search, so thought it may useful to post the answer on here. There is also an additional question about non-contiguous polygons. Instant easy answer: use the command: centroids <- getSpPPolygonsLabptSlots(polys) (This was found in the class description of the SpatialPolygonsDataFrame R data class for the overarching spatial package in R, sp) This seems to do exactly the same thing as cents <- SpatialPointsDataFrame(coords=cents, data=sids@data, proj4string=CRS("+proj=longlat +ellps=clrk66")) in the following code, which should be replicable on any R installation (try it!) Where cents (blue) and centroids (red) are identical centroids (this should plot should appear after you've run the code): So far so good. So this question is 3-things: