Re: [R] subset arg in subset(). was: converting result of substitute to 'ordidnary' expression

2010-06-26 Thread Bill.Venables
Here is another one that works: do.call(subset, list(dat, subsetexp)) x y 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Vadim Ogranovich Sent: Saturday, 26 June 2010 11:13

Re: [R] predict newdata question

2010-06-26 Thread Felipe Carrillo
Thanks Bill, that worked great!!   You ask: # How can I use predict here, 'newdata' crashes predict(m1,newdata=wolf$predicted);wolf # it doesn't work To use predict() you need to give a fitted model object (here m1) and a *data frame* to specify the values of the predictors for which you

Re: [R] Export Results

2010-06-26 Thread Tal Galili
See ?pdf ?png ?sink There is also R2wd (about which I wrote here: http://www.r-statistics.com/2010/05/exporting-r-output-to-ms-word-with-r2wd-an-example-session/ ) And there are also the brew, and Sweave packages (as Henrique mentioned). Best, Tal Contact

Re: [R] create group markers in original data frame ie.countinued... ? to calculate sth for groups defined betweenpoints in one variable (string), /separating/ spliting variable into groups by i.e. be

2010-06-26 Thread Eugeniusz Kałuża
Dear useRs, and expeRts, tahanks I have found idea how to add to oryginal data a column with markers to know with all data in wchich period in c2 they are, suimply in the code I could add: stacked_idx-stack(idx) merge(stacked_idx,C.df,by.x=c('values'),by.y=c('c0'), all=T) thanks for

[R] become a member of R user community

2010-06-26 Thread Albert Lee, Ph.D.
How do I become a member of R user community? Albert Lee, Ph.D. statistician Confidentiality Notice: This communication, and any file...{{dropped:12}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Wilcoxon signed rank test and its requirements

2010-06-26 Thread Atte Tenkanen
Greg Snow kirjoitti 25.6.2010 kello 21.55: Let me see if I understand. You actually have the data for the whole population (the entire piece) but you have some pre-defined sections that you want to see if they differ from the population, or more meaningfully they are different from a

[R] Different standard errors from R and other software

2010-06-26 Thread Min Chen
Hi all, Sorry to bother you. I'm estimating a discrete choice model in R using the maxBFGS command. Since I wrote the log-likelihood myself, in order to double check, I run the same model in Limdep. It turns out that the coefficient estimates are quite close; however, the standard errors are

[R] Accessing matrix elements within a list

2010-06-26 Thread Maria P Petrova
Hi there, I cannot seem to figure out how to access the elements of a list if those elements are a matrix. For example I have a the following list df.list - vector(list, 3) and I have made each of the elements a matrix as follows for(i in 1:3){ assign(paste(s,i, sep=),matrix(0, nrow = 20,

[R] Passing the parameter (file name) to png()

2010-06-26 Thread Maulik Shah
I am fitting 3 parameter model to my response matrix and want to generate item characterstic curve. I want to specify file name to save item characterstic curve by passing it as external parameter to the R batch script. The following is the code I have written for this. *R Script:* library(ltm)

Re: [R] Wilcoxon signed rank test and its requirements

2010-06-26 Thread Atte Tenkanen
Greg Snow kirjoitti 25.6.2010 kello 21.55: Let me see if I understand. You actually have the data for the whole population (the entire piece) but you have some pre-defined sections that you want to see if they differ from the population, or more meaningfully they are different from a

Re: [R] Euclidean Distance Matrix Analysis (EDMA) in R?

2010-06-26 Thread gokhanocakoglu
I am using EDMA for comparing the interlandmark distances of two forms. Actually there is a software called EDMA of course developed by Lele and Richstmeier but main point is I am trying to solve quite different problem on the same data set using R and EDMA so data entry format of EDMA software

Re: [R] Wilcoxon signed rank test and its requirements

2010-06-26 Thread Atte Tenkanen
Atte Tenkanen kirjoitti 26.6.2010 kello 5.15: Greg Snow kirjoitti 25.6.2010 kello 21.55: Let me see if I understand. You actually have the data for the whole population (the entire piece) but you have some pre-defined sections that you want to see if they differ from the population,

Re: [R] become a member of R user community

2010-06-26 Thread Ted Harding
On 25-Jun-10 21:46:13, Albert Lee, Ph.D. wrote: How do I become a member of R user community? Albert Lee, Ph.D. statistician 1. By using R 2. By subscribing to the R-help mailing list and keeping in touch with the rest of us! To subscribe your email address to the list, visit the R-help

[R] Problem: RWinEdt and Windows 7

2010-06-26 Thread Johannes Reichl
Hi I can install RWinEdt if I start R with administrator rigths, but it does not paste my code to the console. I found advice in the link below how to manage the problem, but it did not work, any other idea? http://yusung.blogspot.com/2009/01/rwinedt-and-windows-vistawindow-7.html Thanks a

Re: [R] Passing the parameter (file name) to png()

2010-06-26 Thread jim holtman
b - paste(C:\\rphp\\,arg, sep='') On Sat, Jun 26, 2010 at 12:55 AM, Maulik Shah maulik.shah2...@gmail.com wrote: I am fitting 3 parameter model to my response matrix and want to generate item characterstic curve. I want to specify file name to save item characterstic curve by passing it as

Re: [R] Accessing matrix elements within a list

2010-06-26 Thread jim holtman
first of all take a look at the object you created: df.list - vector(list, 3) for(i in 1:3){ + assign(paste(s,i, sep=),matrix(0, nrow = 20, ncol = 5, byrow + = FALSE, dimnames = NULL)) + } # and then insert them with a loop like this # put matrices names in a vector matrices-c(s1,s2,s3)

[R] Recursive indexing failed at level 2

2010-06-26 Thread Jim Hargreaves
Dear fellow R users, I am replacing elements of a list like so: pulse_subset[[1:20]]=unlist(pulse[i])[1:20] where pulse is a list of lists, and pulse [i] has 20 values. This gives the error Recursive Indexing failed at level 2. But, interestingly this instruction is part of a loop which has

Re: [R] Recursive indexing failed at level 2

2010-06-26 Thread Duncan Murdoch
On 26/06/2010 7:53 AM, Jim Hargreaves wrote: Dear fellow R users, I am replacing elements of a list like so: pulse_subset[[1:20]]=unlist(pulse[i])[1:20] If pulse is a list, then pulse[i] is also a list, with one element. I think you want pulse[[i]], which extracts element i. If

Re: [R] Recursive indexing failed at level 2

2010-06-26 Thread Jim Hargreaves
On 06/26/2010 01:20 PM, Duncan Murdoch wrote: On 26/06/2010 7:53 AM, Jim Hargreaves wrote: Dear fellow R users, I am replacing elements of a list like so: pulse_subset[[1:20]]=unlist(pulse[i])[1:20] If pulse is a list, then pulse[i] is also a list, with one element. I think you want

[R] Recoding dates to session id in a longitudinal dataset

2010-06-26 Thread John-Paul Bogers
Hi, I'm fairly new to R but I have a large dataset (30 obs) containing patient material. Some patients came 2-9 times during the three year observation period. The patients are identified by a unique idnr, the sessions can be distinguished using the session date. How can I recode the date of

Re: [R] Recursive indexing failed at level 2

2010-06-26 Thread Duncan Murdoch
On 26/06/2010 8:29 AM, Jim Hargreaves wrote: On 06/26/2010 01:20 PM, Duncan Murdoch wrote: On 26/06/2010 7:53 AM, Jim Hargreaves wrote: Dear fellow R users, I am replacing elements of a list like so: pulse_subset[[1:20]]=unlist(pulse[i])[1:20] If pulse is a list, then pulse[i]

[R] Recoding session date into session id in a longitudinal dataset

2010-06-26 Thread JP Bogers
Hi, I'm fairly new to R but I have a large dataset (30 obs) containing patient material. Some patients came 2-9 times during the three year observation period. The patients are identified by a unique idnr, the sessions can be distinguished using the session date. How can I recode the date of

Re: [R] Recursive indexing failed at level 2

2010-06-26 Thread Jim Hargreaves
Hi Duncan, list, Thanks for the advice, but unfortunately that wasn't what was causing my problem. I'm still getting the Recursive indexing failed at level 2 message even after replacing my unlist(pulse[i]) with pulse[[i]]. Error:

Re: [R] Recursive indexing failed at level 2

2010-06-26 Thread Duncan Murdoch
Jim Hargreaves wrote: Hi Duncan, list, Thanks for the advice, but unfortunately that wasn't what was causing my problem. I'm still getting the Recursive indexing failed at level 2 message even after replacing my unlist(pulse[i]) with pulse[[i]]. Read the second part of my first message,

Re: [R] Recursive indexing failed at level 2

2010-06-26 Thread Jim Hargreaves
On 06/26/2010 02:07 PM, Duncan Murdoch wrote: Jim Hargreaves wrote: Hi Duncan, list, Thanks for the advice, but unfortunately that wasn't what was causing my problem. I'm still getting the Recursive indexing failed at level 2 message even after replacing my unlist(pulse[i]) with pulse[[i]].

[R] several common sub-axes within multiple plot area

2010-06-26 Thread Karl Brand
Dear List, I'd really appreciate tip's or code demonstrating how i can achieve some common axis labels integrated into a multiple plot. In my example (below), i'm trying to achieve: -a single Results 1 (Int) centered btwn row 1 and row 2; -a single Results 2 (Int) centered btwn row 2 and

Re: [R] integration of two normal density

2010-06-26 Thread Ravi Varadhan
I sent you a doubble integration solution a couple of days ago, that answered your question. You did not have the coureteousy to acknowledge that. Now, you are asking a different question that is incorrectly formulated. What you are doing is not multivariate integration. You are just

Re: [R] integration of two normal density

2010-06-26 Thread Matt Shotwell
On Fri, 2010-06-25 at 23:28 -0400, Carrie Li wrote: Hello everyone, I have a question about integration of two density function Intuitively, I think the value after integration should be 1, but they are not. Am I missing something here ? t=function(y){dnorm(y, mean=3)*dnorm(y/2,

Re: [R] Forcing scalar multiplication.

2010-06-26 Thread Uwe Ligges
t(e$values * t(e$vectors)) Uwe Ligges On 25.06.2010 20:42, rkevinbur...@charter.net wrote: I am trying to check the results from an Eigen decomposition and I need to force a scalar multiplication. The fundamental equation is: Ax = lx. Where 'l' is the eigen value and x is the eigen vector

[R] boot with strata: strata argument ignored?

2010-06-26 Thread Bryan Hanson
Hello All. I must be missing the really obvious here: mm - function(d, i) median(d[i]) b1 - boot(gravity$g, mm, R = 1000) b1 b2 - boot(gravity$g, mm, R = 1000, strata = gravity$series) b2 Both b1 and b2 seem to have done (almost) the same thing, but it looks like the strata argument in b2 has

Re: [R] Calculating Summaries for each level of a Categorical variable

2010-06-26 Thread Corey Sparks
Did you try tapply? ?tapply tapply(RT, RT$R, fun=WA) or something like that - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166

Re: [R] Euclidean Distance Matrix Analysis (EDMA) in R?

2010-06-26 Thread Corey Sparks
I think the hardest thing about true EDMA (meaning the Richtsmeier and Lele version) is the bootstrapping to get significance. Have you tried their software? http://www.getahead.psu.edu/resource_new.html - Corey Sparks, PhD Assistant Professor Department of Demography and Organization

Re: [R] strange behaviour of CairoPNG

2010-06-26 Thread Thomas Steiner
Thank you Henrik for your answer. I hope now I am inline with the posting huide and perhaps I get an answer, thank you. sessionInfo() R version 2.9.0 alpha (2009-03-23 r48200) i386-pc-mingw32 locale:

[R] Calculating Summaries for each level of a Categorical variable

2010-06-26 Thread RaoulD
Hi, I have a dataset which has a categorical variable R,a count variable C (integer) and 4 or more numeric variables (A,T,W,H - integers) containing measures for R. I would like to summarize each level of the variable R by the average for A,T,W and H. I have written a function to calculate

Re: [R] Popularity of R, SAS, SPSS, Stata...

2010-06-26 Thread Muenchen, Robert A (Bob)
-Original Message- From: Joris Meys [mailto:jorism...@gmail.com] Sent: Friday, June 25, 2010 10:10 PM To: Muenchen, Robert A (Bob) Cc: Dario Solari; r-help@r-project.org Subject: Re: [R] Popularity of R, SAS, SPSS, Stata... I had taken the opposite tack with Google Trends by subtracting

Re: [R] Popularity of R, SAS, SPSS, Stata...

2010-06-26 Thread Allan Engelhardt
On 26/06/10 16:07, Muenchen, Robert A (Bob) wrote: I've been trying to make sense of Google Scholar searches. I'm obviously missing something basic. Here are two searches on www.google.com: sas - gets 68M hits sas OR spss - gets 74.3M hits. A bigger number as OR would imply. But when I do

Re: [R] Popularity of R, SAS, SPSS, Stata...

2010-06-26 Thread Dario Solari
Bob, i'm confused. You try a search with Google Scholar or with Google Insights for search? --- useful references for Google Insights for search: * matching terms: http://www.google.com/support/insights/bin/answer.py?hl=enanswer=94777 * interpreting search volumes:

Re: [R] boot with strata: strata argument ignored?

2010-06-26 Thread Charles C. Berry
On Sat, 26 Jun 2010, Bryan Hanson wrote: Hello All. I must be missing the really obvious here: mm - function(d, i) median(d[i]) b1 - boot(gravity$g, mm, R = 1000) b1 b2 - boot(gravity$g, mm, R = 1000, strata = gravity$series) b2 Both b1 and b2 seem to have done (almost) the same thing, but

Re: [R] predict newdata question

2010-06-26 Thread Felipe Carrillo
 Thanks Bill, that worked great!!   You ask: # How can I use predict here, 'newdata' crashes predict(m1,newdata=wolf$predicted);wolf # it doesn't work To use predict() you need to give a fitted model object (here m1) and a *data frame* to specify the values of the predictors for

Re: [R] Popularity of R, SAS, SPSS, Stata...

2010-06-26 Thread Dario Solari
On 26 Giu, 17:19, Allan Engelhardt all...@cybaea.com wrote: On 26/06/10 16:07, Muenchen, Robert A (Bob) wrote: I've been trying to make sense of Google Scholar searches. I'm obviously missing something basic. Here are two searches onwww.google.com: sas - gets 68M hits sas OR spss - gets

Re: [R] become a member of R user community

2010-06-26 Thread Peter Ehlers
On 2010-06-26 3:52, (Ted Harding) wrote: On 25-Jun-10 21:46:13, Albert Lee, Ph.D. wrote: How do I become a member of R user community? Albert Lee, Ph.D. statistician 1. By using R 2. By subscribing to the R-help mailing list and keeping in touch with the rest of us! To subscribe your

Re: [R] how to group a large list of strings into categories based on string similarity?

2010-06-26 Thread G FANG
Hi Martin, Thanks a lot for your advice. I tried the process you suggested as below, it worked, but in a different way that I planned. library(Biostrings) x - c(ACTCCCGCCGTTCGCGCGCAGCATGATCCTG, ACTCCCGCCGTTCGCGCGC, CAGGATCATGCTGCGCGCGAACGGCGGGAGT,

Re: [R] Export Results

2010-06-26 Thread Liviu Andronic
On Sat, Jun 26, 2010 at 7:42 AM, Tal Galili tal.gal...@gmail.com wrote: And there are also the brew, and Sweave packages (as Henrique mentioned). Also, odfWeave and Sweave via LyX. I believe that this is FAQed. Liviu __ R-help@r-project.org mailing

Re: [R] boot with strata: strata argument ignored?

2010-06-26 Thread Bryan Hanson
Thanks Chuck, I understand much better what is going on with your example. But I'm still uncertain why the b2$t array does not have the dimensions of R x no. of strata. Any further insight would be appreciated. Bryan * Bryan Hanson Acting Chair Professor of Chemistry Biochemistry

Re: [R] Calculating Summaries for each level of a Categorical variable

2010-06-26 Thread Christos Argyropoulos
Look at the summary.formula function inside package Hmisc Christos Date: Sat, 26 Jun 2010 05:17:34 -0700 From: raoul.t.dso...@gmail.com To: r-help@r-project.org Subject: [R] Calculating Summaries for each level of a Categorical variable Hi, I have a dataset which has a categorical

[R] dynamic panelmodel pgmm

2010-06-26 Thread marco schuelke
Hi, I want to estimate a dynamic paneldata model with the following code, but unfortenately I received the error message below. form-PB~Activity+Solvency+Cap_Int

[R] optim() not finding optimal values

2010-06-26 Thread Derek Ogle
I am trying to use optim() to minimize a sum-of-squared deviations function based upon four parameters. The basic function is defined as ... SPsse - function(par,B,CPE,SSE.only=TRUE) { n - length(B) # get number of years of data B0 - par[B0]

Re: [R] Wilcoxon signed rank test and its requirements

2010-06-26 Thread Greg Snow
No I mean something like this, assuming that the iris dataset contains the full population and we want to see if Setaso have a different mean than the population (the null would be that there is no difference in sepal width between species, or that species tells nothing about sepal width):

Re: [R] boot with strata: strata argument ignored?

2010-06-26 Thread Charles C. Berry
On Sat, 26 Jun 2010, Bryan Hanson wrote: Thanks Chuck, I understand much better what is going on with your example. But I'm still uncertain why the b2$t array does not have the dimensions of R x no. of strata. Because the test statistic returned by mm() is a scalar. It has nothing to do with

Re: [R] optim() not finding optimal values

2010-06-26 Thread Nikhil Kaza
Your function is very irregular, so the optim is likely to return local minima rather than global minima. Try different methods (SANN, CG, BFGS) and see if you get the result you need. As with all numerical optimsation, I would check the sensitivity of the results to starting values.

Re: [R] Wilcoxon signed rank test and its requirements

2010-06-26 Thread Atte Tenkanen
Thanks! The results were similar to the t.test p-values show (I have four samples). Thank you also for using that replicate-function which i didn't know. Till now I have just used for-loops that are not so beautiful... i don't know about the speed. Have to test that. Atte Greg Snow

Re: [R] subset arg in subset(). was: converting result of substitute to 'ordidnary' expression

2010-06-26 Thread Vadim Ogranovich
It does work, thank you, but the literal 5x now needs to be quoted by expression(): do.call(subset, list(dat, expression(5x))) x y 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 This is ok, but the standard subset(dat, 5x) looks more readable. Anyway, thank you for your help, it's a nice

[R] package(pls) - extracting explained Y-variance

2010-06-26 Thread Christian Jebsen
Dear R-help users, I'd like to use the R-package pls and want to extract the explained Y-variance to identify the important (PLS-) principal components in my model, related to the y-data. For explained X-variance there is a function: explvar(). If I understand it right, the summary()

Re: [R] Different standard errors from R and other software

2010-06-26 Thread Joris Meys
If I understand correctly from their website, discrete choice models are mostly generalized linear models with the common link functions for discrete data? Apart from a few names I didn't recognize, all analyses seem quite standard to me. So I wonder why you would write the log-likelihood yourself

Re: [R] use a data frame whose name is stored as a string variable?

2010-06-26 Thread Seth
Thanks! Works like a charm. -Seth -- View this message in context: http://r.789695.n4.nabble.com/use-a-data-frame-whose-name-is-stored-as-a-string-variable-tp2269095p2269732.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Recursive indexing failed at level 2

2010-06-26 Thread Bill.Venables
Why do you use *double* square brackets on the left side of the replacement? From the help info for [[: The most important distinction between [, [[ and $ is that the [ can select more than one element whereas the other two select a single element. You seem to be selecting 20 elements.

Re: [R] Wilcoxon signed rank test and its requirements

2010-06-26 Thread Daniel Malter
Atte, note the similarity between what Greg described and a bootstrap. The difference to a true bootstrap is that in Greg's version you subsample the population (or in other instances the data). This is known as subsampling bootstrap and discussed in Politis, Romano, and Wolf (1999). HTH, Daniel

[R] Ways to work with R and Postgres

2010-06-26 Thread 顾小波
Hi, I post this message to the general r-help list hoping anyone within a wider range have suggestions: There are three ways to integration R and postgres, especially on 64bit Microsoft windows Platform, 1. via RODBC package, which has 32 bit and 64 bit version for windows 2. via

Re: [R] optim() not finding optimal values

2010-06-26 Thread Ravi Varadhan
Derek, The problem is that your function is poorly scaled. You can see that the parameters vary over 10 orders of magnitude (from 1e-04 to 1e06). You can get good convergence once you properly scale your function. Here is how you do it: par.scale - c(1.e06, 1.e06, 1.e-06, 1.0) SPoptim -

Re: [R] Ways to work with R and Postgres

2010-06-26 Thread Gabor Grothendieck
2010/6/27 顾小波 guxiaobo1...@gmail.com: Hi, I post this message to the general r-help list hoping anyone within a wider range have suggestions: There are three ways to integration R and postgres, especially on 64bit Microsoft windows Platform, 1. via RODBC package, which has 32 bit

Re: [R] optim() not finding optimal values

2010-06-26 Thread Ravi Varadhan
A slightly better scaling is the following: par.scale - c(1.e06, 1.e06, 1.e-05, 1) # q is scaled differently SPoptim - optim(pars, SPsse, B=d$catch, CPE=d$cpe, control=list(maxit=1500, parscale=par.scale)) SPoptim $par B0Kqr 7.320899e+05

Re: [R] Recoding dates to session id in a longitudinal dataset

2010-06-26 Thread John-Paul Bogers
-- Forwarded message -- From: John-Paul Bogers john-paul.bog...@ua.ac.be Date: Sat, Jun 26, 2010 at 10:14 PM Subject: Re: [R] Recoding dates to session id in a longitudinal dataset To: jim holtman jholt...@gmail.com Dear Jim, he data concerns HPV screening data. The data looks