Re: [R] things that are difficult/impossible to do in SAS or SPSS but simple in R

From: Frank E Harrell Jr <f.harrell_at_vanderbilt.edu>
Date: Tue, 15 Jan 2008 17:04:18 -0600

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.
>
> Best,
>
> Matt
>

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) summary(mydata[v])

-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 15 Jan 2008 - 23:08:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Jan 2008 - 00:30:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive