background preloader


Facebook Twitter

Using Dates and Times in R. Today at the Davis R Users’ Group, Bonnie Dixon gave a tutorial on the various ways to handle dates and times in R.

Using Dates and Times in R

Bonnie provided this great script which walks through essential classes, functions, and packages. Here it is piped through knitr::spin. The original R script can be found as a gist here. Date/time classes Three date/time classes are built-in in R, Date, POSIXct, and POSIXlt. Date This is the class to use if you have only dates, but no times, in your data. create a date: dt1 <- as.Date("2012-07-22") dt1 non-standard formats must be specified: dt2 <- as.Date("04/20/2011", format = "%m/%d/%Y") dt2 dt3 <- as.Date("October 6, 2010", format = "%B %d, %Y") dt3 see list of format symbols: Knitr: Elegant, flexible and fast dynamic report generation with R. Overview The knitr package was designed to be a transparent engine for dynamic report generation with R, solve some long-standing problems in Sweave, and combine features in other add-on packages into one package (knitr ≈ Sweave + cacheSweave + pgfSweave + weaver + animation::saveLatex + R2HTML::RweaveHTML + highlight::HighlightWeaveLatex + 0.2 * brew + 0.1 * SweaveListingUtils + more).

knitr: Elegant, flexible and fast dynamic report generation with R

This package is developed on GitHub; for installation instructions and FAQ’s, see README. This website serves as the full documentation of knitr, and you can find the main manual, the graphics manual and other demos / examples here. For a more organized reference, see the knitr book. Motivation One of the difficulties with extending Sweave is we have to copy a large amount of code from the utils package (the file SweaveDrivers.R has more than 700 lines of R code), and this is what the two packages mentioned above have done.

Features Acknowledgements. Kickstarting R. R-fundamentals.pdf. Impatient R. Translations français: Translated by Kate Bondareva.

Impatient R

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. Making R graphics legible in presentation slides. I only visited a few JSM sessions today, as I’ve been focused on preparing for my own talk tomorrow morning.

Making R graphics legible in presentation slides

However, I went to several talks in a row which all had a common problem that made me cringe: graphics where the fonts (titles, axes, labels) are too small to read. You used R's default settings when putting this graph in your slides? Too bad I won't be able to read it from anywhere but the front of the room. Dear colleagues: if we’re going to the effort of analyzing our data carefully, and creating a lovely graph in R or otherwise to convey our results in a slideshow, let’s PLEASE save our graphs in a way that the text is legible on the slides! If the audience has to strain to read your graphics, it’s no easier to digest than a slide with dense equations or massive tables of numbers. For those of us working in R, here are some very quick suggestions that would help me focus on the content of your graphics, not on how hard I’m squinting to read them. Asdfree by anthony damico.

R Bootcamp — Jared Knowles. Intro Welcome to the R Bootcamp.

R Bootcamp — Jared Knowles

Here you can find all the materials used for the Second R Bootcamp for Education at the Wisconsin Department of Public Instruction. These slides represent the slides presented on December 3rd-5th of 2012. However, the slides are being further developed to improve the relevance and usefulness of the material based on feedback received at each bootcamp. In particular, modules 6-8 and the two optional modules are being revised extensively.

For the latest slides and developments on bootcamp materials, check out the GitHub repository with the latest files. OnePageR - StyleO.pdf. OnePageR - BigDataO.pdf. RJournal_2009-2_Williams.pdf. OnePageR - DataO.pdf. Togaware: One Page R: A Survival Guide to Data Science with R. Intro to R. The Junk Charts Challenge: Remaking a great line chart in SPSS. I read and very much enjoy Kaiser Fung’s blog Junk Charts.

The Junk Charts Challenge: Remaking a great line chart in SPSS

One of the exchanges in the comments to the post, Remaking a great chart, Kaiser asserted it was easier to make the original chart in Excel than in any current programming language. I won’t deny it is easier to use a GUI dialog than learn some code, but here I will present how you would go about making the chart in SPSS’s grammer of graphics. The logic extends part-and-parcel to ggplot2. The short answer is the data is originally in wide format, and most statistical packages it is only possible (or at least much easier) to make the chart when the data is in long format.

This ends up being not a FAQ, but a frequent answer to different questions, so I hope going over such a task will have wider utility for alot of charting tasks. Roger Peng. Jeff Leek. Jtleek/dataanalysis. R. R news & tutorials from the web. Twotorials by anthony damico.