Re: [R] numeric operations w/ lists

From: Berton Gunter <gunter.berton_at_gene.com>
Date: Wed 10 Aug 2005 - 03:09:27 EST


Suggestions:

  1. Read the relevant sections of "An Introduction to R" and the R language definition to learn how to work with lists.
  2. ?lapply to learn how to use the apply family on lists

Hint: sapply(X,"-",y=Y)

The above references will tell you what these hieroglyphics mean and what you get. Also why
matrix(unlist(X)-Y,nr=65)

gives you the same result.

"The business of the statistician is to catalyze the scientific learning process." - George E. P. Box    

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of
> Afshartous, David
> Sent: Tuesday, August 09, 2005 9:21 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] numeric operations w/ lists
>
>
> Hello all,
>
> X is a list of 20 lists, and each individual list has 65 elements.
>
> Y is a list of 65 elements.
>
> WANT: subtract Y from each of the 20 lists in X.
>
> Here's what I tried and the error messages:
>
> > X - rep(Y, 20)
> Error in X - rep(Y 20) : non-numeric argument to binary operator
>
> I tried several methods w/o success. Any suggestions kindly
> appreciated.
>
> Thanks,
> Dave
>
> ps - please copy afshar@miami.edu in the reply, as I've had
> problems receiving the daily digest.
>
> ______________________________________________
> R-help@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
>



R-help@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 Received on Wed Aug 10 03:14:41 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:11:41 EST