Re: [R] creating a dynamic output vector

2007-11-07 Thread jim holtman
Here is a script that will find all the atomic objects of length 1 and put them in a dataframe that you then use to determine what variables are there. > a <- 1 # generate some atomic objects > b <- 1.3 > x.char <- "character string" > x.log <- TRUE > x.real <- pi > # get all atomic objects of l

Re: [R] creating a dynamic output vector

2007-11-07 Thread Steve Powers
Everyone is assuming I know what the output data are, or that they come out from my model in some easily called vector. But I don't, and they do not. The outputs are hidden, and all are separate variables that need to be called. Also which ones come out after a given run will vary each time. Al

Re: [R] creating a dynamic output vector

2007-11-07 Thread jim holtman
Here is a function that might do what you want: > # function to create the output > f.output <- function(dat){ + # create the base output vector + output.base <- rep(NA,10) + names(output.base) <- paste("var", 1:10, sep='') + output.base[names(dat)] <- dat + output.base + } > >

Re: [R] Can I replace NA by 0 (if yes, how) ?

2007-11-07 Thread Julian Burgos
Do this: pfit$coefficients[is.na(pfit$coefficients)]=0 Julian Ptit_Bleu wrote: > Hello, > > I'm trying to fit some points with a 8-degrees polynom (result of lm is > stored in pfit). > In most of the case, it is ok but for some others, some coefficients are > "NA". > I don't really understand t

Re: [R] Mixing lty specifications in legend

2007-11-07 Thread Duncan Murdoch
On 07/11/2007 7:01 PM, Peter Dunn wrote: > Hi all > > I have a plot with lines, one specified as (say) lty=1, > using standard line types, and another as (say) my > own spec: lty="51". > > I can't get legend to display both. Toy example: > > >> plot(1~1) >> legend("topright", lty=c("51",1),

Re: [R] Aggregate with non-scalar function

2007-11-07 Thread Mike Nielsen
Yes, that's exactly it! Many thanks, it all comes back to me now! It's the darn do.call that I can never remember somehow. I know I've reinvented this wheel several times -- you'd think I'd learn. Sigh. Again, my thanks! Regards, Mike On Nov 7, 2007 2:35 PM, jim holtman <[EMAIL PROTECTED]>

[R] a newbie question about "data"

2007-11-07 Thread envisage
hi, I am reading Modern Applied Statistics with S 4th ed。 page4 have these two lines: > library(MASS) > data(chem) # needed in R only but I find withou the line " data(chem)" I can still access chem, isn't it? is it unnecessary or something i missed here? thanks for the replay in advance. ___

Re: [R] a newbie question about "data"

2007-11-07 Thread Rolf Turner
On 8/11/2007, at 4:26 PM, envisage wrote: > hi, I am reading Modern Applied Statistics with S 4th ed。 > page4 have these two lines: >> library(MASS) >> data(chem) # needed in R only > but I find withou the line " data(chem)" > I can still access chem, isn't it? > is it unnecessary or something i

Re: [R] a newbie question about "data"

2007-11-07 Thread envisage
Rolf, thanks for the reply, i see now. On Nov 8, 2007 11:43 AM, Rolf Turner <[EMAIL PROTECTED]> wrote: > > > On 8/11/2007, at 4:26 PM, envisage wrote: > > > hi, I am reading Modern Applied Statistics with S 4th ed。 > > page4 have these two lines: > >> library(MASS) > >> data(chem) # needed in R on

<    1   2