Re: [R] Table of basic descriptive statistics like SPSS

From: Philippe Grosjean <phgrosjean_at_sciviews.org>
Date: Tue, 18 Mar 2008 09:53:10 +0100

Jim Lemon wrote:
> ukoenig@med.uni-marburg.de wrote:
>> Dear list readers,
>> I want to:
>>
>> 1. Get a table of basic descriptive statistics for my variables
>> with the variable names one below the other
>> like SPSS descriptive statistics:
>>
>> Varname N Min Max Mean SD
>> xxxx x x x x x
>> xxx x x x x x
>> ....
>>
> This looks very much like the output of the "describe" function in the
> prettyR package. You can specify which summary stats you want (even roll
> your own).

And if that's not enough:

library(pastecs)
data(trees)
t(stat.desc(trees))
?stat.desc

>> 2. Delete some variables from a data frame or exclude variables
>> from beeing analyzed.

df2 <- df[ , -c(1, 3), drop = FALSE]

for instance to eliminate variables in columns 1 and 3, but there are many other ways to select variables to use in an analysis, beginning with the formula interface, see, e.g., ?lm.

>> 3. Create a text file / redirect the terminal output to a
>> file (it is supposed to be easy, but I could not find a solution)?
>>
> sink("myoutputfile.txt")
> do.your.stuff(...)
> sink()
> OR
> maybe you would enjoy "htmlize" or "R2html" in the prettyR package.

... or the R2html package!

>> 4. Create a latex/dvi file
>>
> You do this with Sweave, I think.

See also functions in the Hmisc package.

>> 5. Create a PDF file (can that be done within R?)
>>
> For plots, the pdf device.

See ?pdf

Please, note first search commands:

apropos("pdf")
RSiteSearch("latex")

Using these, you would have found by yourself the various corresponding functions.

Philippe

> Jim
>
> ______________________________________________
> R-help@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.
>



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 18 Mar 2008 - 08:56:22 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 Tue 18 Mar 2008 - 09:30:23 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