From: A.J. Rossini (rossini@blindglobe.net)
Date: Sun 30 Jun 2002 - 15:34:24 EST
Message-id: <87vg81e3dr.fsf@jeeves.blindglobe.net>
>>>>> "tim" == Tim Wilson <wilson@visi.com> writes:
tim> Hello everyone, Thanks to all who offered suggestions after
tim> my initial query to the list. I've been busy trying to
tim> absorb the docs as fast as possible, but this little thing
tim> has me stumped for the moment.
tim> I'm creating a random sample of 100 item and saving it to a
tim> vector named 'iq'. I'd like to create a second vector
tim> (iq_prime, say) by adding 20 to each element of the 'iq'
tim> vector. Here's what I've tried.
Note that "_" is assignment in S (and hence R, sigh...).
>> iq <- rnorm(100, 80, 15)
>> t(dstats(iq)) # Thanks Brett Magill
tim> mean sd variance min max unique n miss skewness
tim> kurtosis
tim> [1,] 78.628 14.223 202.302 49.079 121.294 100 100 0
tim> 0.3 0.191
>> iq_prime <- sapply(iq, function(x)x+20)
iq.prime <- iq + 20
# "." is a separation character, as well as having other overloaded
# meanings.
>> iq_prime
>> t(dstats(iq))
tim> mean sd variance min max unique n miss
tim> skewness kurtosis
tim> [1,] 98.628 14.223 202.302 69.079 141.294 100 100 0
tim> 0.3 0.191
best,
-tony
-- A.J. Rossini Rsrch. Asst. Prof. of Biostatistics U. of Washington Biostatistics rossini@u.washington.edu FHCRC/SCHARP/HIV Vaccine Trials Net rossini@scharp.org -------------- http://software.biostat.washington.edu/ ---------------- FHCRC: M: 206-667-7025 (fax=4812)|Voicemail is pretty sketchy/use Email UW: Th: 206-543-1044 (fax=3286)|Change last 4 digits of phone to FAX (my tuesday/wednesday/friday locations are completely unpredictable.)-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
This archive was generated by hypermail 2.1.3 : Wed 16 Oct 2002 - 11:57:34 EST