[R] things that are difficult/impossible to do in SAS or SPSS but simple in R
Frank E Harrell Jr
f.harrell at vanderbilt.edu
Wed Jan 16 00:04:18 CET 2008
Matthew Keller wrote:
> Hi all,
> I'm giving a talk in a few days to a group of psychology faculty and
> grad students re the R statistical language. Most people in my dept.
> use SAS or SPSS. It occurred to me that it would be nice to have a few
> concrete examples of things that are fairly straightforward to do in R
> but that are difficult or impossible to do in SAS or SPSS. However, it
> has been so long since I have used either of those commercial products
> that I am drawing a blank. I've searched the forums and web for a list
> and came up with just Bob Muenchen's comparison of general procedures
> and Patrick Burns' overview of the three. Neither of these give
> concrete examples of statistical problems that are easily solved in R
> but not the commercial packages.
> Can anyone more familiar with SAS or SPSS think of some examples of
> problems that they couldn't do in one of those packages but that could
> be done easily in R? Similarly, if there are any examples of the
> converse I would also be interested to know.
Here is a simple thing that is easy to do in R or S-Plus but difficult
in SAS or SPSS:
Compute the number of subjects having age below the mean age
sum(age < mean(age))
Here is something not quite so simple that is very difficult to do in
SPSS or SAS. Show descriptive statistics for every variable in a data
frame that is numeric and has at least 10 unique values.
v <- sapply(mydata, function(x) is.numeric(x) && length(unique(x)) >= 10)
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help