[R] Data Frame as Hash Table

2010-05-30 Thread Alan Lue
I'm interested in using a data frame as if it were a hash table. For instance if I had the following, > (d <- data.frame(key=seq(0.5, 3, 0.5), value=rnorm(6))) keyvalue 1 0.5 -1.118665122 2 1.0 0.465122921 3 1.5 -0.529239211 4 2.0 -0.147324638 5 2.5 -1.531503795 6 3.0 -0.002720434 The

Re: [R] Data Frame as Hash Table

2010-05-30 Thread Barry Rowlingson
On Sun, May 30, 2010 at 9:03 AM, Alan Lue wrote: > I'm interested in using a data frame as if it were a hash table.  For > instance if I had the following, > >> (d <- data.frame(key=seq(0.5, 3, 0.5), value=rnorm(6))) >  key        value > 1 0.5 -1.118665122 > 2 1.0  0.465122921 > 3 1.5 -0.52923921

Re: [R] Data Frame as Hash Table

2010-05-30 Thread Patrick Burns
You might want to investigate the 'data.table' package. On 30/05/2010 09:03, Alan Lue wrote: I'm interested in using a data frame as if it were a hash table. For instance if I had the following, (d<- data.frame(key=seq(0.5, 3, 0.5), value=rnorm(6))) keyvalue 1 0.5 -1.118665122 2 1

Re: [R] Question about package coin

2010-05-30 Thread Achim Zeileis
On Sat, 29 May 2010, Bryan Keller wrote: Anyone know if coin can run a permutation test based on a (user-defined) statistic other than the mean difference? The function independence_test does the permutation t-test via difference in means. ...by default, that is. I'm wondering if it's possi

Re: [R] adding statistical output to a plot

2010-05-30 Thread Jim Lemon
On 05/29/2010 10:11 PM, dunner wrote: ... Perhaps "apply" simply doesn't deal with the colname and I have to try a completely different method? Or will apply pass enough information to the included function (mtab.norm) to allow me to annotate the plot? It doesn't seem to, as I tried this on a d

[R] How can I fit a fixed-effect linear model or generalized linear model with method="ml"?

2010-05-30 Thread Sherrie Jin
Hi, I want to fit a linear model (without any random effect) with method "ml". I tried to use "glm" I found that there is no option for "ml" or "reml" and the default one is "reml". THen I tried to use "lme" but it requires a random effect. How can I fix this problem? Of course, it's not necessa

Re: [R] How can I fit a fixed-effect linear model or generalized linear model with method="ml"?

2010-05-30 Thread Achim Zeileis
On Sun, 30 May 2010, Sherrie Jin wrote: Hi, I want to fit a linear model (without any random effect) with method "ml". I tried to use "glm" I found that there is no option for "ml" or "reml" and the default one is "reml". THen I tried to use "lme" but it requires a random effect. How can I fix

Re: [R] How can I fit a fixed-effect linear model or generalized linear model with method="ml"?

2010-05-30 Thread Doran, Harold
Why are you not using the lm() function? OLS is ML with no random effects From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Sherrie Jin [jingo...@gmail.com] Sent: Sunday, May 30, 2010 5:05 AM To: r-help@r-project.org Subject: [R

Re: [R] Vector docs

2010-05-30 Thread Duncan Murdoch
i...@whywouldwe.com wrote: Hi The docs for R are very practical, which is quite refreshing compared to other languages, however I can't find any details about all the things I can do with a vector. I'm expecting methods like vector.contains('foo') and vector.remove('foo'), maybe those methods

Re: [R] Selecting first 7 elements

2010-05-30 Thread David Winsemius
On May 29, 2010, at 11:37 PM, Kang Min wrote: What if I want to select the 8th to 14th element of the list? I tried to use "[" again, but it doesn't work. x[8:14] (And I could not get Iverson's earlier method to work properly on a long list. It just returned the whole list. Did it work pro

Re: [R] Vector docs

2010-05-30 Thread David Winsemius
On May 30, 2010, at 1:43 AM, i...@whywouldwe.com wrote: Hi The docs for R are very practical, which is quite refreshing compared to other languages, however I can't find any details about all the things I can do with a vector. I'm expecting methods like vector.contains('foo') and vector.

[R] geom_ribbon removes missing values

2010-05-30 Thread Karsten Loesing
Hi everyone, it looks like geom_ribbon removes missing values and plots a single ribbon over the whole interval of x values. However, I'd rather want it to act like geom_line, that is, interrupt the ribbon for the interval of missing values and continue once there are new values. Here's an example

Re: [R] Data Frame as Hash Table

2010-05-30 Thread Marshall Feldman
Besides data.table, there's the hash package. It does not use data.frame type structures but is a bit more flexible. Marsh Feldman On 5/30/10 [May 30, 10] 6:00 AM, r-help-requ...@r-project.org wrote: Message: 40 Date: Sun, 30 May 2010 09:24:22 +0100 From: Patrick Burns To:r-help@r-project.org,

Re: [R] create new variable: percentile value of variable in data frame

2010-05-30 Thread Jonathan Beard
Hi Stephan, thanks for your response. It looks like the ecdf() works like it should. I have a quick follow-up: I didn't notice any discussion in the help documents of the methods behind ecdf() and quantile(type=3) being equivalent. It looks like the results produced by each method are consisten

Re: [R] Selecting first 7 elements

2010-05-30 Thread Kang Min
Hmm x[8:14] didn't work. Yes Iverson's method worked, I wanted the whole list, with 7 elements in each vector. Now I want the whole list as well, but with the 8th to 14th element. On May 30, 7:47 pm, David Winsemius wrote: > On May 29, 2010, at 11:37 PM, Kang Min wrote: > > > What if I want to

Re: [R] Vector docs

2010-05-30 Thread i...@whywouldwe.com
Thanks for this, and all the other responses - I have a better understanding now. David Winsemius wrote: On May 30, 2010, at 1:43 AM, i...@whywouldwe.com wrote: Hi The docs for R are very practical, which is quite refreshing compared to other languages, however I can't find any details a

Re: [R] Selecting first 7 elements

2010-05-30 Thread David Winsemius
On May 30, 2010, at 9:44 AM, Kang Min wrote: Hmm x[8:14] didn't work. Yes Iverson's method worked, I wanted the whole list, with 7 elements in each vector. Now I want the whole list as well, but with the 8th to 14th element. Oh, ... then in what sense did the lapply method not work? What cod

Re: [R] Avoiding Loops When Iterating Over Statement That Updates Its Input

2010-05-30 Thread Uwe Ligges
On 26.05.2010 08:52, Alan Lue wrote: Come to think of it, we can't save the output of each invocation and concatenate it later, since we need the output as input for the next iteration. Yes, but you can do it a bit cleverer than before by initializing to the fill length as in: r.seq <- nu

Re: [R] Selecting first 7 elements

2010-05-30 Thread Jorge Ivan Velez
Hi Kang, Try either lapply(x, "[", 8:14) # Erik Iverson's method or lapply(x, function(x) x[8:14]) HTH, Jorge On Sun, May 30, 2010 at 9:44 AM, Kang Min <> wrote: > Hmm x[8:14] didn't work. Yes Iverson's method worked, I wanted the > whole list, with 7 elements in each vector. > > Now I wa

[R] subsetting

2010-05-30 Thread ANJAN PURKAYASTHA
Hi, I have a data-frame, r (column names below), that needs subsetting: date, time, strain, gene, deltact When I try to subset r by applying selection criteria on two columns I get an empty data frame. For example I would like to extract all rows that have time == 0h and strain == ROC. So, t <- s

[R] solve_TSP ignores control data, or I'm reading the help doc incorrectly.

2010-05-30 Thread Steven Lembark
I read the documentation below to mean that: solve_TSP( tsp_input, '2-opt', rep=99 ) will use the 2-opt method on the tsp_input variable 99 times. Catch: I get an "unused input" error. Q: Am I reading the docs (Item 1, below) correctly or is this a problem with solve_TSP ignoring its

Re: [R] difference in sort order linux/Windows (R.2.11.0)

2010-05-30 Thread Steven Lembark
On Fri, 28 May 2010 01:17:49 -0700 (PDT) carslaw wrote: > [4] "HGV-D-Euro-III" "HGV-D-Euro-IV EGR" "HGV-D-Euro-IV SCR" > [4] "HGV-D-Euro-III" "HGV-D-Euro-IV EGR" "HGV-D-Euro-IV SCR" > [7] "HGV-D-Euro-IV SCRb" "HGV-D-Euro-V EGR" "HGV-D-Euro-VI" > [7] "HGV-D-Euro-IV SCRb" "HG

Re: [R] create new variable: percentile value of variable in data frame

2010-05-30 Thread David Winsemius
On May 30, 2010, at 9:03 AM, Jonathan Beard wrote: Hi Stephan, thanks for your response. It looks like the ecdf() works like it should. I have a quick follow-up: I didn't notice any discussion in the help documents of the methods behind ecdf() and quantile(type=3) being equivalent. It looks

Re: [R] simpleError in storage.mode(y)

2010-05-30 Thread Uwe Ligges
Please tell us the code you used and we may be able to help you interpreting the error message. PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Uwe Ligges On 29.05.2010 23:05, anzid wrote: hello

Re: [R] simpleError in storage.mode(y)

2010-05-30 Thread anzid
Thank you Uve ligges The SimpleError is solved ( 1 data abscent ) thank you -- View this message in context: http://r.789695.n4.nabble.com/simpleError-in-storage-mode-y-tp2235745p2236367.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] How to use the function "glht" of multcomp package to test interaction?

2010-05-30 Thread RICHARD M. HEIBERGER
Usually you will want to look at simple effects of the factors when there is interaction. Please look at the WoodEnergy demos in the HH package. These examples use glht. install.packages("HH") ## if you don't currently have HH library(HH) demo("MMC.WoodEnergy-aov") demo("MMC.WoodEnergy") Rich

Re: [R] library location and error messages when loading packages

2010-05-30 Thread Uwe Ligges
On 24.05.2010 03:59, Daisy Englert Duursma wrote: Hello, I am running R on a server that several people share. Previously we all had separate libraries for R. I have set up R so everyone on the server shares the same library and I downloaded the latest version of R and installed it on the main

[R] How to use the function "glht" of multcomp package to test interaction?

2010-05-30 Thread Ivan Allaman
It's been a few weeks I'm racking my brains on how to use the function glht the package multcomp to test interactions. Unfortunately, the creator of the package forgot to put a sample in pdf package how to do it. I have looked in several places, but found nothing. If someone for the love of God ca

Re: [R] subsetting

2010-05-30 Thread Patrick Burns
'&&' is scalar 'and' you want to use the vector 'and' which is '&'. On 30/05/2010 16:14, ANJAN PURKAYASTHA wrote: Hi, I have a data-frame, r (column names below), that needs subsetting: date, time, strain, gene, deltact When I try to subset r by applying selection criteria on two columns I get

Re: [R] subsetting

2010-05-30 Thread David Winsemius
On May 30, 2010, at 11:14 AM, ANJAN PURKAYASTHA wrote: Hi, I have a data-frame, r (column names below), that needs subsetting: date, time, strain, gene, deltact When I try to subset r by applying selection criteria on two columns I get an empty data frame. For example I would like to extrac

Re: [R] Data Frame as Hash Table

2010-05-30 Thread Alan Lue
Thanks, guys! Alan On Sun, May 30, 2010 at 5:35 AM, Marshall Feldman wrote: > Besides data.table, there's the hash package. It does not use data.frame > type structures but is a bit more flexible. > > Marsh Feldman > > On 5/30/10 [May 30, 10] 6:00 AM, r-help-requ...@r-project.org wrote: >> >> M

Re: [R] extracat , JGR, iWidgets install problems

2010-05-30 Thread Uwe Ligges
On 26.05.2010 15:28, Michael Friendly wrote: [Environment: Win XP, R 2.10.1] I'm trying to install the packages JGR and iWidgets required by the extracat package to make the interactive plots in the package work. I've tried various things, but nothing seems to work. Here is my most recent atte

Re: [R] Avoiding Loops When Iterating Over Statement That Updates Its Input

2010-05-30 Thread Alan Lue
Is there a performance advantage to doing this, as opposed to growing the vector within the loop? I suppose R could have to dynamically reallocate memory at some point? Alan 2010/5/30 Uwe Ligges : > > > On 26.05.2010 08:52, Alan Lue wrote: >> >> Come to think of it, we can't save the output of

Re: [R] R on the iPhone/iPad? Not so much....a GPL violation

2010-05-30 Thread Tal Galili
Android + rattle: http://www.r-bloggers.com/data-mining-through-the-android/ Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-sta

[R] Calling fft from C

2010-05-30 Thread Gunnar Hellmund
Hi I have made a R function 'convolve2' for convolution of two real valued vectors based on Rs 'convolve' with option type="open" - see below. (exp.length and irf.length are variables set in another part of the program) I wish to implement the function convolve2 in C and use it in a function used

Re: [R] Calling fft from C

2010-05-30 Thread Gabor Grothendieck
The Writing R Extensions manual specifically uses convolve as an example of calling C from R. On Sun, May 30, 2010 at 2:08 PM, Gunnar Hellmund wrote: > Hi > > I have made a R function 'convolve2' for convolution of two real > valued vectors based on Rs 'convolve' with option type="open" - see > b

Re: [R] Avoiding Loops When Iterating Over Statement That Updates Its Input

2010-05-30 Thread Uwe Ligges
On 30.05.2010 19:23, Alan Lue wrote: Is there a performance advantage to doing this, as opposed to growing the vector within the loop? I suppose R could have to dynamically reallocate memory at some point? Right, but that takes time since memory management is always expensive (and this way

Re: [R] subsetting

2010-05-30 Thread sayan dasgupta
try t <- subset(r, (r$time == "0h" & r$strain == "ROC"), select= c(time,strain, gene, deltact)) Do ?"&" to understand the difference between & and && . ANJAN PURKAYASTHA wrote: > > Hi, > I have a data-frame, r (column names below), that needs subsetting: > date, time, strain, gene, deltac

Re: [R] How can I fit a fixed-effect linear model or generalized linear model with method="ml"?

2010-05-30 Thread Sherrie Jin
Thanks for your reply. I should have made my question clearer. Yes, I want to estimate standard errors with the method "ml" rather than "reml". According to your suggestion, I looked at the source code for "summary.glm". Now I know it's "summary.glm" rather than "glm" itself estimates the standard

Re: [R] Calling fft from C

2010-05-30 Thread Gunnar Hellmund
Thanks for the reply, but ... No, I am not interested in the convolution function defined in the R-extensions manual. I want to use a fast fourier transform version implemented in C returning values to another C function. So the question is: How do I call the fft supplied by R in C? (just like it

Re: [R] Question about package coin

2010-05-30 Thread Bryan Keller
Thanks for the reply, that answers my question.  I'm actually interested in using the Welch t in a randomization model framework where the variance heterogeneity is introduced by the treatment effect and is not present under the null hypothesis of no differential treatment effect.  In other wo

[R] Gamma regression doesn't converge

2010-05-30 Thread Sherrie Jin
When I ran a Gamma regression in SAS, the algorithm converged. When I ran it in R, it keeps uncoverged even if I used 1 iterations. What was wrong? I used the following code in R: glm(y ~ x1 x2 x3, control=glm.control(maxit=1), data, family=Gamma(link="log")) [[alternative HTML ver

[R] [R-pkgs] New package RSQLite.extfuns and minor upgrade for RSQLite

2010-05-30 Thread Seth Falcon
RSQLite.extfuns provides SQLite extension functions for use with RSQLite. The package is a wrapper of extension functions written by Liam Healy and made available through the SQLite website (http://www.sqlite.org/contrib). You can make the extension functions available on a per db connection basi

Re: [R] Calling fft from C

2010-05-30 Thread biostatmatt
The fft in R has the following C call chain file purpose src/main/names.c links R function "fft" to do_fft src/main/fourier.cdo_fft calls fft_factor, fft_work src/appl/fft.chome of fft_factor, fft_work If you want to use the fft at a low level, yo

Re: [R] Gamma regression doesn't converge

2010-05-30 Thread Joshua Wiley
On Sun, May 30, 2010 at 12:16 PM, Sherrie Jin wrote: > When I ran a Gamma regression in SAS, the algorithm converged. When I ran it > in R, it keeps uncoverged even if I used 1 iterations. What was wrong? > I used the following code in R: > glm(y ~ x1 x2 x3, control=glm.control(maxit=1), d

[R] Building a list

2010-05-30 Thread Noah Silverman
Hello, I need to build a "list of lists" We have 20 groups we are generating MCMC samples for. There are 10 coefficients, and 1 MCMC iterations. I would like to store each iteration by-group in a list. My problem is with the first iteration. Here is a toy example: Chain <- list() for (j

Re: [R] Building a list

2010-05-30 Thread Joshua Wiley
Hello Noah, Does this work for you? Chain <- vector("list", 1) for (j in 1:1){ coef <- c(1,2,3,4,5,6,7,8,9,10) #would be actual MCMC samples Chain[[j]] <- rbind(Chain[[j]], coef) If it does, this has the additional advantage that it tends to be faster to initialize the list at siz

Re: [R] Building a list

2010-05-30 Thread Noah Silverman
That would be great, except I just realized I made a typo when sending my code. I'm tracking 20 coefficents for 10 groups. So I need a "top" list of 10 groups. Then each of the 10,000 samples for each of the 20 coefficients. It should be more like this: for(j in 1:1){ for(g in groups)

Re: [R] Building a list

2010-05-30 Thread jim holtman
Let initialize Chain: Chain <- vector('list', 5) groups <- 1:5 for(j in 1:1){ for(g in groups){ coef <- c(1,2,3,4,5,6,7,8,9,10) #would be actual MCMC samples Chain[[g]] <- rbind(Chain[[g]], coef) } } On Sun, May 30, 2010 at 6:05 PM, Noah Silverman wrote: > That would

[R] sanity-checking plans for glmer

2010-05-30 Thread Mitchell Maltenfort
Having briefly fallen for the notion that the negative.binomial family in MASS could be used in glmer, I want to use these lists for a sanity check on my final (?) plans. I want to use glmer for logistic regression and for poisson regression on a data set of 10,000 items. There will be two crosse

Re: [R] Selecting first 7 elements

2010-05-30 Thread Kang Min
Sorry I made a mistake in my code, lapply(x, "[", 8:14) works fine now. Thanks. On May 30, 10:55 pm, Jorge Ivan Velez wrote: > HiKang, > > Try either > > lapply(x, "[", 8:14)   # Erik Iverson's method > > or > > lapply(x, function(x) x[8:14]) > > HTH, > Jorge > > > > > > On Sun, May 30, 2010 at 9

Re: [R] Building a list

2010-05-30 Thread Noah Silverman
Nice. Thanks! -N On 5/30/10 3:16 PM, jim holtman wrote: > Let initialize Chain: > > Chain <- vector('list', 5) > groups <- 1:5 > for(j in 1:1){ > >for(g in groups){ > >coef <- c(1,2,3,4,5,6,7,8,9,10) #would be actual MCMC samples > >Chain[[g]] <- rbind(Chain[[g]], coef)

Re: [R] Data Frame as Hash Table

2010-05-30 Thread Don MacQueen
If you only need a single variable (in this case value), and just want to refer to it by the "key", there are other options. value <- rnorm(6) names(value) <- format(seq(0.5,3,0.5)) value['1.5'] But do watch out for numerical precision in the output of seq() if your vector of values

[R] geepack installation problem?

2010-05-30 Thread Denis B
Hello R Forum members. I have installed for my statistician user, apparently without error, both the concord and geepack packages. The target system is R 2.10.1 on a 64-bit RedHat Enterprise Linux platform. However when she attempts to invoke a function in geepack, for example... geeglm((abus

[R] Creating dropout time from longitudinal data with missing data

2010-05-30 Thread john james
Dear R users,   Please assist me with the following problem. I have a dataset that looks like the following:   dat<-data.frame(   'id'=rep(c(1,2,3),each=3),   'time'=rep(c(1,2,3),3),   'y'= c(2,2,NA,2,NA,NA,2,5,7) )   I wish to create a variable for dropout time in dataframe 'dat' such that the

Re: [R] Kalman Filter

2010-05-30 Thread Johann Hibschman
Greigiano Jose Alves writes: > I am working on an article forecasting, which use the dynamic linear model, > a model state space. I am wondering all the commands in R, to represent the > linear dynamic model and Kalman filter. > I am available for any questions. There are a few libraries out the