Tag Archives: R

Stratified random sampling in R from a data frame

After a little bit more work, there’s a new stratified random sampling function, this one letting you sample from a data frame, returning all the variables for each of your samples as a nice data frame that you can continue working on as usual. Get the function at http://news.mrdwab.com/stratified. Usage notes in the head of [...]

Posted in Geekiness, Useless Knowledge | Also tagged , , , , | 4 Comments

Stratified Random Sampling in R–A Function in Progress

IMPORTANT: This is here mostly to remind me of how I solved my problem. You should read Stratified random sampling in R from a data frame if you really want to use this function. I know that sampling is quite complex, and I will admit that I know very little about its complexities. Fortunately, software [...]

Posted in (all categories), Geekiness, Useless Knowledge | Also tagged , , , , , | Leave a comment

Reshaping data in R revisited

A year ago, I wrote a post about reshaping data from a wide format to a long format. I thought that considering how much time had passed, it would be good to revisit R’s in-built reshape functions. For these examples, I’ve copied the Stata examples from the UCLA Academic Technology Services’s “Reshape data wide to [...]

Posted in Geekiness, Useless Knowledge | Also tagged , , , | Leave a comment

Regular expressions in R

In my last post (Sounds interesting. Is that a regular expression?), I showed a few things I had figured out recently related to regular expressions. By now, you have also figured out that I like figuring things out in R, and application of regular expressions is one of these things.

Posted in Geekiness, Useless Knowledge | Also tagged , | Leave a comment

Sounds interesting. Is that a regular expression?

I’ve been meaning to learn how to use regular expressions for quite some time now, but just never seemed to get around to doing so. The other night, I decided to take a stab at them though, and over the past few days, I’ve sort of managed to learn a few tricks. Some of these [...]

Posted in (all categories), Geekiness, Useless Knowledge | Also tagged , | Leave a comment

The new sample size calculator for R (already)

aka “Maybe I shouldn’t post so quickly” Just hours ago, I posted my first set of functions for R to determine the sample size for a known population. Then, I had to update that post to reflect my newfound knowledge, and now, I thought I would update again, so that the best functions I came [...]

Posted in (all categories), Geekiness, Useless Knowledge | Also tagged , , , , | 7 Comments

A sample size calculator function for R

IMPORTANT: This is here mostly to remind me of how I solved my problem. You should read The new sample size calculator for R (already) if you really want to use this function. In the research class at the Tata-Dhan Academy, students are currently getting into sampling, so I thought I would introduce them to [...]

Posted in (all categories), Geekiness, Useless Knowledge | Also tagged , , , | 2 Comments

Using the reshape package in R for pivot-table-like functionality

A little more than a week ago, I wrote about creating pivot tables in Microsoft Excel and OpenOffice.org. I also mentioned that I would explain how to do similar calculations by using R. This post will explain how to achieve similar results in R by using the reshape package. I had initially started experimenting with [...]

Posted in (all categories), Geekiness, Useless Knowledge | Also tagged , , , , , , , , , , | 8 Comments

Getting data into R

When you first open R, you’re greeted with a screen similar to the following: ?View Code RSPLUS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 R version 2.10.0 (2009-10-26) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0   R is free software [...]

Posted in (all categories), Geekiness, Useless Knowledge | Also tagged | Leave a comment

R is like a giant calculator for grownups

One of the things that is interesting about R is how flexible it is. One of the fun things about it is how interactive it can be. While my examples so far have been a little bit more involved, it can be useful to spend some time just getting acquainted with how R performs basic [...]

Posted in (all categories), Geekiness, Useless Knowledge | Also tagged | Leave a comment