Descriptive statistics for tables
I do not totally understand your question as well. You seem to want a
descriptive statistic about a unitary number. What is the sd of a number?
or any other descriptive statictic. Maybe you mean for the columns or rows
or it could be that these are t-stats or z-stats that you need to get
p_values for them. In any case what I would do assuming that these tables
are in your env is the following
sapply(ls(), function(x){
nam <- paste(x,"_summary", sep="")
tt <- colMeans(get(x))
assign(nam, tt, pos=1)})
The function above will output a number of tables with their original name
an extension _summary which contains the column means of the tables.
If you have the tables in different files on your box you need to add a
read.table line above. and the function becomes
sapply(dir(), function(x){
nam <- paste(x,"_summary", sep="")
assign(x, read.table(x))
tt <- colMeans(x)
assign(nam, tt, pos=1)})
HTH
On Fri, 30 Sep 2005, DAVID CAMACHO wrote:
Thanks for your response, What I need is extremely simple. And I suppose there are so many way to do it. But as I have so many files to do it, I am looking for the simplest way (if possible) What I meant was that I have tables with the same numbers of rows and columns, (square form, should I say?) like: 2,5,7 3,4,8 2,9,3 5,3,8 2,5,5 5,7,8 But I have hundreds of this onces, (bigger once). Every one of this tables have the same size (columns, rows). And I want to obtain the sd, z-score, and p-value for the position [1,1], [1,2].... [2,1],[2,2]... etc etc. That is, to obtain a table with some simple descriptive statistics about all this tables. I have try different methods, but I am no familiar with R. (by the way, I could not find the way to do loops with R) Any suggestion is welcome. David --- Berton Gunter <gunter.berton at gene.com> wrote:
I don't know what a "quadratic, same size" table is or what you mean. If you do not get a satisfactory reply I suggest: 1. Read and follow the posting guide at the end of this message. 2. In particular, provide a simple, reproducible example to show what you want to do and perhaps any error messages that you may have received. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA
-----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On
Behalf Of DAVID CAMACHO
Sent: Thursday, September 22, 2005 9:10 AM To: r-help at stat.math.ethz.ch Subject: [R] Descriptive statistics for tables I have a lot (more than one hundred) of files with
tables of
the same kind (quadratic, same size) and I want to
obtain
some statistics for every position on them.
Therefore, as a
result I want another table. I import every table,
and create
an object read.table for it, then I have try to
create a
list or a data frame and directly utilize some
functions
like sd( ) without success, because it calculate
sd for the
columns . Which kind of object should I create
in order to
utilize directly this kind of functions? Should I
program it
throw for loops? David
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html