Re: [R] standard errors of regression coefficients

2007-10-03 Thread Jeffrey Robert Spies
stderr_int - summary(lm(y ~ x))$coefficients[1,2] stderr_slope - summary(lm(y ~ x))$coefficients[2,2] Jeff. On Oct 3, 2007, at 3:01 AM, Alexander Moreno wrote: Hi, If I have two vectors x and y and I do lm(y~x) and now I want to define variables that are the standard errors of the slope

Re: [R] convert time series to data.frame

2007-09-30 Thread Jeffrey Robert Spies
Hi Edna, Can you send a small subset of the data as an example and the function call you used to read the data in originally? It might be helpful in understanding why you're losing the time element. Jeff. On Oct 1, 2007, at 12:27 AM, Edna Bell wrote: Dear R gurus I would like to take a

Re: [R] simple matching with R

2007-09-28 Thread Jeffrey Robert Spies
Not sure how you want to handle the NAs, but you could try the following: #start MalVar29_37 - read.table(textConnection(V1 V2 V3 V4 V5 V6 V7 V8 V9 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 NA NA NA NA NA NA NA NA NA 0 1 0 0 0 1 0 0 0), header=TRUE)

Re: [R] A matrix multiplication

2007-09-27 Thread Jeffrey Robert Spies
How about this: a - matrix(cbind(rep(2, 500), rep(3, 500)), 500, 2) b - matrix(cbind(rep(5, 500), rep(6, 500), rep(7, 500)), 500, 3) matrix(apply(a, c(2), *, b), nrow=500, ncol=6) We apply the multiplier (quoted as specified in the apply help) with argument b to every column of a as specified

Re: [R] removing a specific number of digist from a character string

2007-09-17 Thread Jeffrey Robert Spies
test - c(060907_17_3_5_1_1_2909.tif, 060907_17_3_5_2_1_2910.tif, 060907_17_3_5_3_1_2911.tif) sub('[[:digit:]][[:digit:]][[:digit:]][[:digit:]]\.tif', '', test) or test - c(060907_17_3_5_1_1_2909.tif, 060907_17_3_5_2_1_2910.tif, 060907_17_3_5_3_1_2911.tif) sub('[[:digit:]]{4}\.tif', '', test)

Re: [R] data frame

2007-09-17 Thread Jeffrey Robert Spies
I believe you're looking for: dim(a) dim(a)[1] # Number of observations, in your example, 12 dim(a)[2] # Number of variables per observation, in your example, 9 --Jeff. On Sep 17, 2007, at 12:05 PM, Alfredo Alessandrini wrote: Hi everybody, If I've a data frame like this: dataframe a

Re: [R] removing a specific number of digist from a character string

2007-09-17 Thread Jeffrey Robert Spies
For the sake of absolute correctness: sub('[[:digit:]]{4}\.tif', '', test) should be sub('[[:digit:]]{4}\\.tif', '', test) -- Jeff. On Sep 17, 2007, at 11:59 AM, Jeffrey Robert Spies wrote: test - c(060907_17_3_5_1_1_2909.tif, 060907_17_3_5_2_1_2910.tif, 060907_17_3_5_3_1_2911.tif) sub