Re: [R] AIC in bestglm, glm, and lm - why do they differ?

2010-10-15 Thread Bill.Venables
AIC is only defined up to an additive constant (as is log-likelihood). It should not surprise you that the values for AIC differ between packages. The real question is whether the change in AIC when going form one model to anoth is the same. If not, one is wrong (at least). -Original

[R] using apply function and storing output

2010-10-15 Thread David A.
Hi list, I have a 1710x244 matrix of numerical values and I would like to calculate the mean of every group of three consecutive values per column to obtain a new matrix of 570x244. I could get it done using a for loop but how can I do that using apply functions? In addition to this, do I

Re: [R] Downloading file with lapply

2010-10-15 Thread Uwe Ligges
On 15.10.2010 09:19, Santosh Srinivas wrote: I'm still getting familiar with lapply I have this date sequence x- seq(as.Date(01-Jan-2010,format=%d-%b-%Y), Sys.Date(), by=1) #to generate series of dates I want to apply the function for all values of x . so I use lapply (Still a newbie!) I

Re: [R] using apply function and storing output

2010-10-15 Thread Dennis Murphy
Hi: Look into the rollmean() function in package zoo. HTH, Dennis On Fri, Oct 15, 2010 at 12:34 AM, David A. dasol...@hotmail.com wrote: Hi list, I have a 1710x244 matrix of numerical values and I would like to calculate the mean of every group of three consecutive values per column to

Re: [R] using apply function and storing output

2010-10-15 Thread Dimitris Rizopoulos
one efficient way to do this, avoiding loops, is using the rowsum() function, e.g., mat - matrix(rnorm(1710*244), 1710, 244) id - rep(seq_len(570), each = 3) means - rowsum(mat, id, FALSE) / 3 Regarding the second part of your question, indeed a gold rule of efficient R programming when it

Re: [R] Time vs Concentration Graphs by ID

2010-10-15 Thread Anh Nguyen
Hello Dennis, That's a very good suggestion. I've attached a template here as a .png file, I hope you can view it. This is what I've managed to achieve in S-Plus (we use S-Plus at work but I also use R because there's some very good R packages for PK data that I want to take advantage of that is

[R] Help with R

2010-10-15 Thread Muteba Mwamba, John
Dear Sir/Madam; I'm not sure whether this is the correct contact for help. I've been recently working with R on my project, unfortunately It sudenly crashes! It gives me the following message: FATAL ERROR: unable to restore saved data in .RDATA I decided to uninstall the copy (a R2.11.0) and

Re: [R] Downloading file with lapply

2010-10-15 Thread Santosh Srinivas
Thx. -Original Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Sent: 15 October 2010 13:11 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] Downloading file with lapply On 15.10.2010 09:19, Santosh Srinivas wrote: I'm still getting familiar with

Re: [R] import statsoft statistica files?

2010-10-15 Thread marbal
orduek wrote: Is there an option to import .sta files to R? I know you can import SPSS ones. thank you. Hi: I have the same problem. Did you manage in the end to import .sta files to R? thank you -- View this message in context:

[R] Set value if else...

2010-10-15 Thread Joel
Hi I want to set a variable to either 1 or 0 depending on an value of a dataframe and then add this as a colum to the dataframe. This could be done with a loop but as we are able to do questions on a complete row or colum without a loop it would be sweet if it could be done. for example:

Re: [R] fast rowCumsums wanted for calculating the cdf

2010-10-15 Thread Joshua Wiley
On Fri, Oct 15, 2010 at 12:23 AM, Joshua Wiley jwiley.ps...@gmail.com wrote: Hi, You might look at Reduce().  It seems faster.  I converted the matrix to a list in an incredibly sloppy way (which you should not emulate) because I cannot think of  the simple way. Dennis provided the answer:

[R] Biweight (Tukey) M-estimator of location with known scale parameter

2010-10-15 Thread Ondrej Vozar
Dear colleagues, I would like to ask you how to estimate biweight M-estimator of Tukey with known scale example. I know how to estimate biweight M-estimator if estimated scale is used using function rml in package MASS. library(MASS) x-rnorm(1000) rlm(x~1,psi=psi.bisquare) But I would like to

Re: [R] Set value if else...

2010-10-15 Thread Joshua Wiley
Dear Joel, On Fri, Oct 15, 2010 at 1:16 AM, Joel joda2...@student.uu.se wrote: Hi I want to set a variable to either 1 or 0 depending on an value of a dataframe and then add this as a colum to the dataframe. This could be done with a loop but as we are able to do questions on a complete

Re: [R] Set value if else...

2010-10-15 Thread Dimitris Rizopoulos
try this: table$VoteRight - as.numeric(table$age 18) Best, Dimitris On 10/15/2010 10:16 AM, Joel wrote: Hi I want to set a variable to either 1 or 0 depending on an value of a dataframe and then add this as a colum to the dataframe. This could be done with a loop but as we are able to

Re: [R] Set value if else...

2010-10-15 Thread Joel
Indeed I was close :) Thx for the fast respond! Have a good day //Joel -- View this message in context: http://r.789695.n4.nabble.com/Set-value-if-else-tp2996667p2996682.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Time vs Concentration Graphs by ID

2010-10-15 Thread David Winsemius
On Oct 15, 2010, at 3:46 AM, Anh Nguyen wrote: Hello Dennis, That's a very good suggestion. I've attached a template here as a .png file, I hope you can view it. This is what I've managed to achieve in S- Plus (we use S-Plus at work but I also use R because there's some very good R

Re: [R] Set value if else...

2010-10-15 Thread Rubén Roa
x - data.frame(x=1:10) require(gtools) x$y - ifelse(odd(x$x),0,1) HTH R. Dr. Rubén Roa-Ureta AZTI - Tecnalia / Marine Research Unit Txatxarramendi Ugartea z/g 48395 Sukarrieta (Bizkaia) SPAIN -Mensaje

[R] Create Arrays

2010-10-15 Thread dpender
Hi, For this example: O - c(0 0 0 2 0 0 2 0) I want to create an array every time O[i] 0. The array should be in the form; R[j] - array(-1, dim=c(2,O[i])) i.e. if O[i] 0 4 times I want 4 R arrays. Does anyone have any suggestions? Thanks, Doug -- View this message in context:

Re: [R] using apply function and storing output

2010-10-15 Thread David A.
Hi Dennis and Dimitris, thanks for your answers. I am trying the rollmean() function and also the rollapply() function because I also want to calculate CV for the values. For this I created a co.var() function. I am having problems using them. co.var-function(x)( +sd(x)/mean(x) +)

Re: [R] Create Arrays

2010-10-15 Thread Barry Rowlingson
On Fri, Oct 15, 2010 at 9:55 AM, dpender d.pen...@civil.gla.ac.uk wrote: Hi, For this example: O - c(0 0 0 2 0 0 2 0) I want to create an array every time O[i] 0.  The array should be in the form; R[j] - array(-1, dim=c(2,O[i])) i.e. if O[i] 0 4 times I want 4 R arrays. Does

Re: [R] Create Arrays

2010-10-15 Thread Gerrit . Eichner
Hi, Doug, maybe columns - c( 0, 3, 0, 2, 0, 1) lapply( columns[ columns 0], function( o) array( -1, dim = c( 2, o))) does what you want? Regards -- Gerrit - AOR Dr. Gerrit Eichner Mathematical

[R] Random assignment

2010-10-15 Thread John Haart
Dear List, I am doing some simulation in R and need basic help! I have a list of animal families for which i know the number of species in each family. I am working under the assumption that a species has a 7.48% chance of being at risk. I want to simulate the number of species expected to

Re: [R] Biweight (Tukey) M-estimator of location with known scale parameter

2010-10-15 Thread Christian Hennig
Have a look at the package smoothmest. Christian On Fri, 15 Oct 2010, Ondrej Vozar wrote: Dear colleagues, I would like to ask you how to estimate biweight M-estimator of Tukey with known scale example. I know how to estimate biweight M-estimator if estimated scale is used using function

Re: [R] interaction contrasts

2010-10-15 Thread Kay Cichini
hello, i was shortly asking the list for help with some interaction contrasts (see below) for which i had to change the reference level of the model on the fly (i read a post that this is possible in multcomp). if someone has a clue how this is coded in multcomp; glht() - please point me

Re: [R] Time vs Concentration Graphs by ID

2010-10-15 Thread Dennis Murphy
Hi: To get the plots precisely as you have given them in your png file, you're most likely going to have to use base graphics, especially if you want a separate legend in each panel. Packages ggplot2 and lattice have more structured ways of constructing such graphs, so you give up a bit of

Re: [R] Create Arrays

2010-10-15 Thread dpender
Barry, Gerrit, That was what I am after but unfortunately only the starting point. I am now trying to amend a function that inserts the R matrices into a dataset in the correct places: i.e. H - c(0.88, 0.72, 0.89, 0.93, 1.23, 0.86, 0.98, 0.85, 1.23) T - c(7.14, 7.14, 7.49, 8.14, 7.14, 7.32,

[R] R 2.12.0 is released

2010-10-15 Thread Peter Dalgaard
I've rolled up R-2.12.0.tar.gz a short while ago. This is a development release which contains a number of new features. Also, a number of mostly minor bugs have been fixed. See the full list of changes below. You can get it from http://cran.r-project.org/src/base/R-2/R-2.12.0.tar.gz or wait

Re: [R] Data Gaps

2010-10-15 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 14.10.2010 10:34:12: Thanks Dennis. One more thing if you don't mind. How to I abstract the individual H and T “arrays” from f(m,o,l) so as I can combine them with a date/time array and write to a file? Try to look at ?merge function

Re: [R] merging and working with BIG data sets. Is sqldf the best way??

2010-10-15 Thread Chris Howden
Thanks for the advice Gabor, I was indeed not starting and finishing with sqldf(). Which was why it was not working for me. Please forgive a blatantly obvious mistake. I have tried what U suggested and unfortunately R is still having problems doing the join. The problem seems to be one of

<    1   2