Re: [R] R looping help

2013-05-17 Thread Adams, Jean
It's difficult to see where your error is when you provide no accompanying data for us to test your code out on (X? Y? Stand?). However, it looks like you are making your code more complex than it needs to be. Are you simply trying to a fit a separate linear regression to each subset of your da

Re: [R] R looping help

2013-05-16 Thread rishard
Thanks for the reply, running that gave me this: I tried understanding it using the example you gave but I'm not to R savy. Does this output mean anything to you? -- View this message in context: http://r.789695.n4.nabble.com/R-loo

Re: [R] R looping help

2013-05-16 Thread MacQueen, Don
You can use basic debugging techniques to help understand what is going wrong. For example, insert a cat() statement right before the statement which is giving the warning. Like this: ## your code mses[st]<-sum(resid(model)^2)/(length(xi)-2) ssr<-var(yi)*(length(xi)-1)-sum(resid(model)^2) #

[R] R looping help

2013-05-16 Thread rishard
Hey I'm not really sure what I should put on here, but I am having trouble with my R code. I am trying to get the p-values, R^2s etc for a number of different groups of variables that are all in one dataset. This is the code: #Stand counter st<-1 #Collections stands<-numeric(67) slopes<-numeric(