[R] Some coefficients are doubled when I use the step() function

2012-12-09 Thread Chris Beeley
and read and re-read the step() and stepAIC() documentation and I just can't figure out what it could mean. Removing the test="F" bit also generates the same behaviour. Any help greatly appreciated. Chris Beeley Institute of Mental Health, UK _

[R] Problem with aggregating data across time points

2010-07-02 Thread Chris Beeley
then 23-5-2008 0 0 0 0 again, and etc. I've had several abortive attempts and done some Googling but have got nowhere. I'd greatly appreciate any advice. Many thanks, Chris Beeley (Institute of Mental Health, UK) structure(list(Location = structure(c(1L, 2L, 2L, 1L, 3L, 5L, 5L, 1L, 1L,

Re: [R] Odp: Problem with aggregating data across time points

2010-07-03 Thread Chris Beeley
; A) sum each of the dependent variables for each of the dates (so e.g. >>> in the example above for 1-4-2007 it would be 3+2=5, 0+1=1, 1+2=3, and >>> 3+4=7 for each of the variables) >>> >>> B) do this sum, but only in each location this time (lo

[R] How to remove rows based on frequency of factor and then difference date scores

2010-08-24 Thread Chris Beeley
r many hours of fiddling I have had to admit defeat. I would be very grateful for any words of advice. Many thanks, Chris Beeley, Institute of Mental Health, UK __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLE

Re: [R] How to remove rows based on frequency of factor and then difference date scores

2010-08-24 Thread Chris Beeley
Many thanks to you both. I have now filed away for future reference the 2 factor tapply as well as the extremely useful looking plyr library. And the code worked beautifully :-) On 24 Aug 2010, at 19:47, "Abhijit Dasgupta, PhD" wrote: > The paste-y argument is my usual trick in these situat

[R] Subset command and the : operator

2011-05-27 Thread Chris Beeley
ith the 5:8 usage in case I put it somewhere else and don't notice the problem. Many thanks! Chris Beeley Institute of Mental Health __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] odfWeave repeats output

2011-08-12 Thread Chris Beeley
anyone on any forums or anything with the same problem. Using R v2.13 on Windows, v 2.12 on Linux, was using RStudio but just tested it without (just in case) and it does the same thing. Any suggestions gratefully received. Chris Beeley Institute of Mental Health, UK. Output of the operation is

[R] Basic question about re-writing for loop as a function

2011-08-29 Thread Chris Beeley
ant the function to return, for the first column, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0 (because those are the values of Words which contain a 1) and for the second column return 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 (because the fifth value is the only one that contains a 2). Any suggestions gratefully received!

[R] anova of lme objects (model1, model2) gives different results depending on order of models

2012-05-31 Thread Chris Beeley
to accept model 2 even though they are opposite models. Is it really just that you have to put them in the right order? It just seems like if there were say four models you wouldn't necessarily be able to determine the correct order. Many thanks, Chris Beeley, Institute of Mental Health, UK

Re: [R] anova of lme objects (model1, model2) gives different results depending on order of models

2012-05-31 Thread Chris Beeley
Well that's that cleared up then. Thanks to all. Chris B. On 31/05/2012 17:51, Albyn Jones wrote: No, both yield the same result: reject the null hypothesis, which always corresponds to the restricted (smaller) model. albyn On Thu, May 31, 2012 at 12:47:30PM +0100, Chris Beeley wrote:

[R] Replace selected columns of a dataframe with NA

2011-06-20 Thread Chris Beeley
ution, which would be much more important, if say I just wanted to replace the odd columns, or something like that. I found this code on the internet too: idx <- which(foo>80, arr.ind=TRUE) foo[idx[1], idx[2]] <- NA But I can't seem to rewrite that either, for the same reason Many t

[R] Match strings across two differently sized dataframes and copy corresponding row to dataframe

2011-06-30 Thread Chris Beeley
s.na(datavec)]]) # yields 1567 length(comments$ImproveCat[commvec[!is.na(commvec)]]) # yields 1512 I'm sorry, I did try to construct an example dataframe, but ironically I can't make that work either! Sorry! Any help gratefully received. Many thanks! Chris Be

[R] as.numeric() generates NAs inside an apply call, but fine outside of it

2012-01-09 Thread Chris Beeley
gure out what's special about the apply call that generates the NAs when as.numeric(mydata[,2]) doesn't and I'm not sure what to do about it in future. I realise I can just loop over the columns, but I would rather get to the bottom of this if I can so I know for future. Thanks i

Re: [R] as.numeric() generates NAs inside an apply call, but fine outside of it

2012-01-09 Thread Chris Beeley
Perfect, many thanks for explanation and correct line of code. On 09/01/2012 14:29, peter dalgaard wrote: as.data.frame(lapply(mydata, as.numeric)) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the p

[R] Nested brew call yields Error in .brew.cat(26, 28) : unused argument(s) (26, 28)

2012-03-28 Thread Chris Beeley
t of stuff about beer and not much else (drew a blank also from RSiteSearch("Nested brew")) Any help gratefully received. Chris Beeley Institute of Mental Health, UK __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-

Re: [R] Nested brew call yields Error in .brew.cat(26, 28) : unused argument(s) (26, 28)

2012-04-02 Thread Chris Beeley
e ever had this happen to them? If so did you find a solution (other than manually removing the NAs using a final piece of code, which admittedly is not too arduous). Many thanks, Chris Beeley, Institute of Mental Health, UK On 30/03/2012 02:27, Matt Shotwell wrote: On Wed, 2012-03-28 at 11:40 +0

[R] Extract fitted values with and without offset from glm

2012-04-05 Thread Chris Beeley
, 13L, 13L, 13L, 14L, 14L, 14L, 14L, 14L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L)), .Names = c("Incident", "Numbers"), row.names = c(NA, 50L), class = "data.frame") Any assistance gratefully recieved. Many thanks, Chri