[R] Odp: computing and showing mean

From: Petr PIKAL <petr.pikal_at_precheza.cz>
Date: Wed, 11 Jun 2008 11:54:25 +0200

Hi

r-help-bounces_at_r-project.org napsal dne 11.06.2008 08:41:27:

> Hello to everyone,
> I am trying to compute a mean and show it to the screen and then save to
later be used
> as a boxplot.I have used the following code:
> dat<-read.table(file="C:\\Documents and Settings\\Owner\\My
Documents\\Yeast\

here you get data frame

> \Yeast.txt",header=T,row.names=1)
> file.show(file="C:\\Documents and Settings\\Owner\\My
Documents\\Yeast\\Yeast.txt")
> x<-dat[2,23:46]

x is data frame consisting from row 2 and columns 23:46 of data frame dat

> y=mean(x,trim=0,na.rm=T)

y is named vector numerically the same as x (you compute mean of one value)

if you want to see how your objects look like just print them on your console by simply typing

x or y.

If you want to see internal structure do

str(x) or str(y)

> save(y,file="ydata")
> Am I computing the mean correctly and how to I show the value of the
mean to the screen?

Maybe its time to have a small glimpse into some basic documentation like R-intro.

I may guess you want mean of columns 25:46. If this is true, then

colMeans(dat[, 23:46])

prints means for defined columns.
And
boxplot(dat[, 23:46])

gives you boxplots for each column.

But enough of speculation what do you really want.

Regards
Petr

>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



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 Wed 11 Jun 2008 - 12:56:56 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 11 Jun 2008 - 13:30:38 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