Publications by Slawa Rokicki

Basics of Histograms

22.12.2012

Histograms are used very often in public health to show the distributions of your independent and dependent variables.  Although the basic command for histograms (hist()) in R is simple, getting your histogram to look exactly like you want takes getting to know a few options of the plot.  Here I present ways to customize your histogram for your...

5988 sym 16 img

For loops (and how to avoid them)

14.01.2013

My experience when starting out in R was trying to clean and recode data using for() loops, usually with a few if() statements in the loop as well, and finding the whole thing complicated and frustrating.In this post, I’ll go over how you can avoid for() loops for both improving the quality and speed of your programming, as well as...

5578 sym 10 img

Translating Weird R Errors

20.01.2013

I love R. I think it’s intuitive and clever and overall a great language. But I do get really annoyed sometimes at the completely ridiculous, cryptic error messages it often gives me.  This post will go over some of those seemingly nonsensical errors so you don’t have to go crazy trying to find the bug in your code.1. all arguments must have...

3218 sym 6 img

Converting a dataset from wide to long

01.02.2013

I recently had to convert a dataset that I was working with from a wide format to a long format for my analysis.  I struggled with this a bit, but finally found the right sources and the right package to do it, so I thought I’d share my practical example of reshaping data in R. This post is specifically helpful for those using Demographic and...

5399 sym R (82 sym/1 pcs) 6 img

Normal distribution functions

25.02.2013

Ah, the Central Limit Theorem.  The basis of much of statistical inference and how we get those 95% confidence intervals.  It’s just so beautiful!  Lately, I have found myself looking up the normal distribution functions in R.  They can be difficult to keep straight, so this post will give a succinct overview and show you how th...

3363 sym R (698 sym/3 pcs) 6 img 1 tbl

Extracting Information From Objects Using Names()

17.03.2013

One of the big differences between a language like Stata compared to R is the ability in R to handle many different types of objects at once, and combine them together or pull them apart.  I had a post about objects last year, but I thought I’d show in this post how to extract information from objects you create in R.For this examp...

4531 sym R (222 sym/6 pcs) 26 img

Mastering Matrices

07.04.2013

R has many ways to store information.  Most of the time, our data comes in the form of a dataset, which we bring into R as a data.frame object. However, there are times when we want to use matrices as well. This post will show you how matrices can be useful and how to manipulate them easily.First of all, the big difference between ma...

5738 sym R (625 sym/9 pcs) 12 img 1 tbl

Sample size calculations equivalent to Stata functions

25.06.2013

<p>Loading …</p> Related To leave a comment for the author, please follow the link and comment on their blog: R for Public Health. 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. Want to share your content on ...

419 sym

Let’s Make a Date: Date and Time classes in R

11.07.2013

<p>Loading …</p> Related To leave a comment for the author, please follow the link and comment on their blog: R for Public Health. 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. Want to share your content on ...

419 sym

Exporting Results of Linear Regression with Robust Standard Errors

24.08.2013

<p>Loading …</p> Related To leave a comment for the author, please follow the link and comment on their blog: R for Public Health. 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. Want to share your content on ...

419 sym