[R] How to extract sublist from a list?

2011-08-04 Thread richard.ma
Hi everyone, Suppose I have a list named lst, see below: lst $sub1 ... $sub1$x ... $sub1$y $sub2 ... $sub2$x ... $sub2$y … $sub3 ... ... ... Now, I want to extract the sub-sublist $y from every sublist(sub1, sub2...) and then storage them to a new list. I know how to extract them by

[R] persp()

2011-08-04 Thread Rosario Garcia Gil
Hello I am trying to draw a basic black and white map of two European countries. After searching some key words in google and reading many pages I arrived to the conclusion that persp() could be used to draw that map. I have prepared three small example files, which are supposed to be the

[R] Question about contrasts and interpreting glm output for factors

2011-08-04 Thread dhinds
I'm fitting a logistic regression model of the form: outcome ~ covariates + A*B where A and B are factors -- A has 4 levels, B has 2 levels. The A and B term each have significant main effects and the interaction term is significant. I'd like to ask, how does a particular set of A and B

Re: [R] Error message for MCC

2011-08-04 Thread Florent D.
You defined temp as a vector: temp - vector(mode=numeric, length = vl) but you try to extract from it as if it was a 2d object: colA - temp[,compareA] Maybe you meant to use temp1 instead? More meaningful variable names might help avoid such mistakes. On Wed, Aug 3, 2011 at 6:14 PM, Matt

Re: [R] How to extract sublist from a list?

2011-08-04 Thread Richard Ma
Thank you so much GlenB! I got it done using your method. I'm just curious how did you get this idea? Cause for me, this looks so tricky Cheers, Richard - I'm a PhD student interested in Remote Sensing and R Programming. -- View this message in context:

[R] Rdconv LaTeX files

2011-08-04 Thread Michael O'Keeffe
Hi, I've written a package and converted my Rd files into LaTeX using Rdconv. When I copy and paste these files in to my Sweave document I get the error message when compiling the Sweave file: ! Undefined control sequence. l.32 \inputencoding {utf8} I also get the error

Re: [R] Possible bug of QR decomposition in package Matrix

2011-08-04 Thread Joshua Wiley
Hi C6 (were C1 - 5 already taken in your family?), I downloaded your data and can replicate your problem. R ceases responding and terminates. This does not occur with all uses of qr on a dgCMatrix object. I know nothing about sparse matrices, but if you believe this should not be occurring,

Re: [R] How to extract sublist from a list?

2011-08-04 Thread Ashim Kapoor
Dear All, How would we do this problem looping over seq(1:2) ? Thank you, Ashim On Thu, Aug 4, 2011 at 10:59 AM, Richard Ma xuanlong...@uts.edu.au wrote: Thank you so much GlenB! I got it done using your method. I'm just curious how did you get this idea? Cause for me, this looks so

Re: [R] How to extract sublist from a list?

2011-08-04 Thread Ashim Kapoor
How would we do this problem looping over seq(1:2) ? To extend the example in the corresponding nabble post : - sub1-list(x=a,y=ab) sub2-list(x=c,y=ad) lst-list(sub1=sub1,sub2=sub2) for ( t in seq(1:2) ) print(lst[[t]]$y) So I can print out the sub1$y/sub2$y but it's not clear how to

Re: [R] How to extract sublist from a list?

2011-08-04 Thread Joshua Wiley
On Thu, Aug 4, 2011 at 12:12 AM, Ashim Kapoor ashimkap...@gmail.com wrote: How would we do this problem looping over seq(1:2) ? Because this goes to an email list serv, it is good practice to quote the original problem. I have no idea what this is. To extend the example in the corresponding

Re: [R] Possible bug of QR decomposition in package Matrix

2011-08-04 Thread C6H5NO2
Thank you very much, Josh! As you suggested, I will contact the developers of Matrix. PS, C6 are just initial characters of my email account :-) Best wishes, C6 2011/8/4 Joshua Wiley jwiley.ps...@gmail.com: Hi C6 (were C1 - 5 already taken in your family?), I downloaded your data and can

Re: [R] How to extract sublist from a list?

2011-08-04 Thread Ashim Kapoor
On Thu, Aug 4, 2011 at 1:02 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: On Thu, Aug 4, 2011 at 12:12 AM, Ashim Kapoor ashimkap...@gmail.com wrote: How would we do this problem looping over seq(1:2) ? Because this goes to an email list serv, it is good practice to quote the original

Re: [R] How to extract sublist from a list?

2011-08-04 Thread Joshua Wiley
On Thu, Aug 4, 2011 at 1:40 AM, Ashim Kapoor ashimkap...@gmail.com wrote: On Thu, Aug 4, 2011 at 1:02 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: On Thu, Aug 4, 2011 at 12:12 AM, Ashim Kapoor ashimkap...@gmail.com wrote: How would we do this problem looping over seq(1:2) ? Because

[R] How to get the test statistic corresponding to the p-value in mtable?

2011-08-04 Thread Erich Striessnig
Dear R-Users, I want to use mtable from package memisc to produce Latex-style estimation output. However, mtable() only gives me a p-value and not the corresponding test-statistic. Does anyone know how to extract it, either from a glm/anova object or mtable? Here is a short example: # Run this

Re: [R] How to get the test statistic corresponding to the p-value in mtable?

2011-08-04 Thread Joshua Wiley
Hi Erich, Thanks for the example. You can access the coefficient table output by a call to summary: coef(summary(res1)) so if you want the test statistic (the t value here), just extract the third column of the matrix: coef(summary(res1))[, 3] or to keep in matrixy form

Re: [R] How to extract sublist from a list?

2011-08-04 Thread Ashim Kapoor
On Thu, Aug 4, 2011 at 2:12 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: On Thu, Aug 4, 2011 at 1:40 AM, Ashim Kapoor ashimkap...@gmail.com wrote: On Thu, Aug 4, 2011 at 1:02 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: On Thu, Aug 4, 2011 at 12:12 AM, Ashim Kapoor

Re: [R] How to extract sublist from a list?

2011-08-04 Thread Joshua Wiley
On Thu, Aug 4, 2011 at 2:08 AM, Ashim Kapoor ashimkap...@gmail.com wrote: On Thu, Aug 4, 2011 at 2:12 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: On Thu, Aug 4, 2011 at 1:40 AM, Ashim Kapoor ashimkap...@gmail.com wrote: On Thu, Aug 4, 2011 at 1:02 PM, Joshua Wiley

Re: [R] Incorrect degrees of freedom for splines using GAMM4?

2011-08-04 Thread Simon Wood
Thanks for reporting this. It was a bug, now fixed in gamm4 0.1-3. Simon On 19/07/11 22:16, Melinda Power wrote: Hello, I'm running mixed models in GAMM4 with 2 (non-nested) random intercepts and I want to include a spline term for one of my exposure variables. However, when I include a

Re: [R] How to extract sublist from a list?

2011-08-04 Thread Ashim Kapoor
Thank you Joshua. Ashim. On Thu, Aug 4, 2011 at 2:53 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: On Thu, Aug 4, 2011 at 2:08 AM, Ashim Kapoor ashimkap...@gmail.com wrote: On Thu, Aug 4, 2011 at 2:12 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: On Thu, Aug 4, 2011 at 1:40 AM,

Re: [R] R-help Digest, Vol 102, Issue 4

2011-08-04 Thread fraenzi . korner
Wir sind bis am 20. August in den Ferien und werden keine e-mails beantworten. Bei dringenden Fällen melden Sie sich bei Stefanie von Felten steffi.vonfel...@oikostat.ch We are on vacation until 20. August. In urgent cases, please contact Stefanie von Felten steffi.vonfel...@oikostat.ch

Re: [R] 3D Bar Graphs in ggplot2?

2011-08-04 Thread Jim Lemon
On 08/03/2011 11:07 PM, wwreith wrote: So I take it 3D pie charts are out? P.S. It is not about hiding anything. It is about consulting and being told by your client to make 3D pie charts and change this font or that color to make the graphs more apealing. Given that I am the one trying to open

Re: [R] Tinn-R problem: unable to send code to R

2011-08-04 Thread Eik Vettorazzi
Hi Richard, Have you configured Tinn-R to work with R? Check your Rprofile.site #quick configuration check in R grep(.trPaths,readLines(file.path(R.home(component=etc),Rprofile.site)))0 If that fails, Tinn-R helps you to do all the necessary config steps, just use the menu R - Configure -

Re: [R] R.app installer probs on Snow Leopard

2011-08-04 Thread Walter Ludwick
Thanks, Peter and David, for the pointers -and my apologies to the list for posting to the wrong place; i will in future use the SIG-Mac list for such things. To the problem: Yes, i did indeed make that fundamental error of taking the R.app GUI package to be all i needed to run the program. I

[R] Problems with Z in rhierMnlRwMixture using bayesm

2011-08-04 Thread ea819
Dear All, I am using rhierMnlRwMixture in the bayesm package for the analysis of data from a choice experiment. I am trying to follow the margarine example set out in the bayesm manual (p.28). However, after several attempts I keep getting an error message with regards to my Z matrix as below.

[R] phyres function in caper package

2011-08-04 Thread j . vanwoerden
## I clicked the send-button too quickly, before changing the title of the message etc... Sorry.## I am running following phylogenetic analyses with the caper package: data=read.table(file=data.txt,header=T,sep=\t) tree = read.nexus(Tree.nex) primate = comparative.data(phy=tree, data=data,   

Re: [R] Cannot clean infinite values

2011-08-04 Thread mayouf.k
hi everyone, i had the same problem, i simply wrote: *ifelse(is.infinite(AALB),NA,AALB)* this code replace infinite values by NA's, then you can use na.omit, replace, or even a zero, which is my case. goog luck Nigel -- View this message in context:

[R] Semiparametric double-index Klein Vella 2009 estimator question.

2011-08-04 Thread pegasus_sudaka
Dear List's Members, I'm trying to implement 1. Roger Klein and Francis Vella, “A semiparametric model for binary response and continuous outcomes under index heteroscedasticity,” Journal of Applied Econometrics 24, no. 5 (2009): 735-762. estimator. I have a technical doubt about the choice of

[R] R loop problem

2011-08-04 Thread testrider
I have run into a speed issue, and given the size of the problem it feels like there should be an easy solution. Here is the problem statement with some arbitrary numbers added. #p,q: vector with length(q)==length(p)==1 and length(levels(p))==3000 #y,z: vectors with

Re: [R] How to extract sublist from a list?

2011-08-04 Thread pegasus_sudaka
Hi, have you considered using array, for example example-array(1,dim=c(2,2,3)) dimnames(example)-list(c(x1,x2),c(y1,y2)) then if you want to extract the component x1,y1 from every member of the list of matrices you have to example[x1,y1,] leaving blank in the last position. hope it helps.

Re: [R] General indexing in multidimensional arrays

2011-08-04 Thread Jannis
Thanks, Michael. I was, however, after a function I coul use for both extracting and replacing subarrays. In case anybody else stumbles over this problem, here is my solution. Its programming is most probably horribly clumsy: ind.datacube = function( ##title create logical index matrices for

[R] extractAIC

2011-08-04 Thread Roby
Use extractAIC in frailty cox model (estimated with coxph function, gaussian random effect) i obtaided extractAIC(fit.cox.f) [1] 11.84563 8649.11736 but I don't know why I can't use the classic formulation of the AIC where the degree of freedom are the number of the parameter (in my case 3).

Re: [R] Coefficient names when using lm() with contrasts

2011-08-04 Thread Peter Morgan
Many thanks, Greg. It works like a dream. Best wishes, Pete From: Greg Snow greg.s...@imail.org To: Peter Morgan morga...@cardiff.ac.uk, r-help@r-project.org r-help@r-project.org Date: 03/08/2011 19:06 Subject:Re: [R] Coefficient names when using lm() with contrasts Sent by:

Re: [R] How to extract sublist from a list?

2011-08-04 Thread Richard Ma
Hi Joshua, Really helpful that you posted so many useful solutions for my problem. I can understand all your codes except these: *[code] lapply(lst, `[[`, y) ## or if you are only retrieving a single value sapply(lst, `[[`, y) [/code]* Can you explain these a little bit? What does '[[' means?

[R] New multilevel modelling course practicals for the lmer and glmer functions - now online

2011-08-04 Thread Hilary Browne
The Centre for Multilevel Modelling is very pleased to announce the addition of R practicals to our free on-line multilevel modelling course. These give detailed instructions of how to carry out a range of analyses in R, starting from multiple regression and progressing through to multilevel

[R] Sweave: pdf-graphics got three times lager with R 2.13.1

2011-08-04 Thread eriksengewald
Dear R-Users, I am using R for years now but recently I encounter a problem with the pdf-size of graphics generated with sweave. However, I am new in this forum. Hence, please don't hesitate if I am wrong here. I use a script which runs perfectly in R 2.11.1 and the pdf-size of the graphs is

Re: [R] R loop problem

2011-08-04 Thread jim holtman
A subset of actual data and what you would expect as a result would be very helpful. All you say is that p.q are vectors, but it would appear that they are character vectors, but the content is unknown. Also will the expression q[i==p]-z[i==y] have the same length on each side; the vectors

Re: [R] 3D Bar Graphs in ggplot2?

2011-08-04 Thread Martin Maechler
Duncan Murdoch murdoch.dun...@gmail.com on Tue, 2 Aug 2011 16:51:38 -0400 writes: On 11-08-02 2:39 PM, wwreith wrote: Does anyone know how to create a 3D Bargraph using ggplot2/qplot. I don't mean 3D as in x,y,z coordinates. Just a 2D bar graph with a 3D shaped bard.

Re: [R] persp()

2011-08-04 Thread Eik Vettorazzi
Hi Rosario, you might have a look at the maps and maptools (for reading shape-files) packages. #e.g. library(maps) map(world,c(sweden,germany)) Cheers Am 04.08.2011 02:58, schrieb Rosario Garcia Gil: Hello I am trying to draw a basic black and white map of two European countries. After

Re: [R] persp()

2011-08-04 Thread Jean V Adams
Rosario, I don't think persp() is the function you need. You may find that the maps in R's historical world map would work for you. In that case you can try something like this (an example mapping France and Germany): require(maps) map(world, c(France, Germany), xlim=c(-6.61, 17.21),

Re: [R] Rdconv LaTeX files

2011-08-04 Thread Duncan Murdoch
On 11-08-04 1:42 AM, Michael O'Keeffe wrote: Hi, I've written a package and converted my Rd files into LaTeX using Rdconv. When I copy and paste these files in to my Sweave document I get the error message when compiling the Sweave file: ! Undefined control sequence. l.32 \inputencoding

Re: [R] R loop problem

2011-08-04 Thread Jean V Adams
Try this: q - z[match(p, y)] Jean `·.,, (((º `·.,, (((º `·.,, (((º Jean V. Adams Statistician U.S. Geological Survey Great Lakes Science Center 223 East Steinfest Road Antigo, WI 54409 USA 715-627-4317, ext. 3125 (Office) 715-216-8014 (Cell) 715-623-6773 (FAX)

Re: [R] 3D Bar Graphs in ggplot2?

2011-08-04 Thread Duncan Murdoch
On 11-08-04 8:20 AM, Martin Maechler wrote: Duncan Murdochmurdoch.dun...@gmail.com on Tue, 2 Aug 2011 16:51:38 -0400 writes: On 11-08-02 2:39 PM, wwreith wrote: Does anyone know how to create a 3D Bargraph using ggplot2/qplot. I don't mean 3D as in x,y,z coordinates.

[R] limma contrast matrix

2011-08-04 Thread Belmont, John W
I am trying to correct for the effect of 2 covariates in a gene expression data set. design-model.matrix(~0 + Factor + cov1 + cov2) QUESTION: How to set up the contrast matrix? The usual commands fit - lmFit(selDataMatrix, design) cont.matrix - makeContrasts(FacCont=Group1-Group2,

[R] Counting rows given conditional

2011-08-04 Thread a217
Hello, I have an input file that contains multiple columns, but the column I'm concerned about looks like: TR 5 0 4 1 0 2 0 To count all of the rows in the column I know how to do NROW(x$TR) which gives 7. However, I would also like to count only the number of rows with values =1 (i.e. not 0).

Re: [R] Possible bug of QR decomposition in package Matrix

2011-08-04 Thread Martin Maechler
C6H5NO2 c6h5...@gmail.com on Thu, 4 Aug 2011 16:03:54 +0800 writes: Thank you very much, Josh! As you suggested, I will contact the developers of Matrix. PS, C6 are just initial characters of my email account :-) Best wishes, C6 well, as the posting guide

[R] Odp: Counting rows given conditional

2011-08-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 04.08.2011 14:56:09: a217 aj...@case.edu Odeslal: r-help-boun...@r-project.org 04.08.2011 14:56 Komu r-help@r-project.org Kopie Předmět [R] Counting rows given conditional Hello, I have an input file that contains multiple

Re: [R] identifying weeks (dates) that certain days (dates) fall into

2011-08-04 Thread Dimitri Liakhovitski
Sorry for renewing the topoic. I thought it worked but now I've run into a little problem: # My data frame with dates for week starts (Mondays) y-data.frame(week=seq(as.Date(2009-12-28), as.Date(2011-12-26),by=week) ) # I have a vector of super bowl dates (including the future one for 2012):

Re: [R] limma contrast matrix

2011-08-04 Thread James W. MacDonald
Hi John, The limma package is part of Bioconductor, so you should be asking this question on the BioC listserv bioconduc...@r-project.org rather than R-help. In addition, please see the posting guide. The example you give is not self-contained, and the term 'does not work' is so unspecific

Re: [R] How to extract sublist from a list?

2011-08-04 Thread R. Michael Weylandt michael.weyla...@gmail.com
I'm not Josh Wiley, but I think I can answer this: When dealing with lists, its often more convenient to use [[ instead of [ because [ returns a single element list while [[ returns the list element itself. (i.e., if I set x = list(Q = rnorm(64), V = matrix(rnorm(64),8)) then x[Q] is a list that

[R] Plotting just a portion of a smoother graph in ggplot2

2011-08-04 Thread Christopher Desjardins
Hi, I am using ggplot2 to with the following code: gmathk2 - qplot(time,math,colour=Kids,data=kids.ach.lm.k5,geom=smooth,method=lm,formula=y~ns(x,1)) + opts(title=Smoother Plot: Math K-5) + xlab(Time) + ylab(Math) + scale_colour_brewer(pal=Set1); gmathk2 This plots all the smoother for all the x

Re: [R] R loop problem

2011-08-04 Thread testrider
Worked like a charm! Thanks a lot Jean V Adams -- View this message in context: http://r.789695.n4.nabble.com/R-loop-problem-tp3718449p3718670.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Plotting multiple age distributions with histogram()

2011-08-04 Thread Juliane Struve
Dear list,   I would like to plot several age distributions that are influenced by a factor (called group in the data example below). I would like to use historam() in the lattice package, but I can't figure out how to set up the data. Could someone give me a hint how to do it  for the example

Re: [R] conditional data replace (recode, change or whatsoever)

2011-08-04 Thread R. Michael Weylandt michael.weyla...@gmail.com
Best I know, they are effectively the same** within R but I prefer [ for a couple of reasons. 1) [ works for all data types, while $ is sometimes picky: e.g., x = matrix(rnorm(9),3); colnames(x) - c(a,b,c) x.df = as.data.frame(x) x$a gives Error in x$a : $ operator is invalid for atomic vectors

Re: [R] slow computation of functions over large datasets

2011-08-04 Thread Paul Hiemstra
Hi all, After reading this interesting discussion I delved a bit deeper into the subject matter. The following snippet of code (see the end of my mail) compares three ways of performing this task, using ddply, ave and one yet unmentioned option: data.table (a package). The piece of code

Re: [R] Rdconv LaTeX files

2011-08-04 Thread Michael O'Keeffe
Thanks! I found (by properly reading docs) to use the inputenc package. The Rd package solve most problems except for where I has a multiple line code element in my Rd file. I tried to convert it to a LaTeX Rd 'code' element and use an 'alltt' environment to hold the multi-line text. I worked

Re: [R] limma contrast matrix

2011-08-04 Thread Patrick Breheny
On 08/04/2011 08:53 AM, Belmont, John W wrote: I am trying to correct for the effect of 2 covariates in a gene expression data set. design-model.matrix(~0 + Factor + cov1 + cov2) QUESTION: How to set up the contrast matrix? The usual commands fit - lmFit(selDataMatrix, design) cont.matrix -

Re: [R] Plotting just a portion of a smoother graph in ggplot2

2011-08-04 Thread Timothy Bates
It's not immediately obvious You need to look at coord_cartesian() and its ylim argument. Best, t Sent from my iPhone On 4 Aug 2011, at 02:38 PM, Christopher Desjardins cddesjard...@gmail.com wrote: Hi, I am using ggplot2 to with the following code: gmathk2 -

Re: [R] Possible bug of QR decomposition in package Matrix

2011-08-04 Thread C6H5NO2
Thank you, Martin. Yes, on my computer (48Gb memory) it also gives a message caught segfault as you got. So it is because the matrix size is too large. I apologize for the offence I've caused. 2011/8/4 Martin Maechler maech...@stat.math.ethz.ch: C6H5NO2  c6h5...@gmail.com     on Thu, 4 Aug

[R] use of modMCMC

2011-08-04 Thread Paola Lecca
Dear all, I used modFit of the package FME to fit a set of ODE to a ste of eperiemntal data. The summary of this fit give me the following error summary(Fit) Residual standard error: 984.1 on 452 degrees of freedom Error in cov2cor(x$cov.unscaled) : 'V' is not a square numeric matrix In

[R] Efficient way of creating a shifted (lagged) variable?

2011-08-04 Thread Dimitri Liakhovitski
Hello! I have a data set: set.seed(123) y-data.frame(week=seq(as.Date(2010-01-03), as.Date(2011-01-31),by=week)) y$var1-c(1,2,3,round(rnorm(54),1)) y$var2-c(10,20,30,round(rnorm(54),1)) # All I need is to create lagged variables for var1 and var2. I looked around a bit and found several ways of

[R] error bar plot with log scale in lattice

2011-08-04 Thread Xiao Hu
Hi, all, I'm trying to modify the code to a log scale for y-axis from the post http://tolstoy.newcastle.edu.au/R/help/06/06/28612.html However, the error bar did not change accordingly. The following is the code I used based on the singer.ucl data. Thanks in advance! prepanel.ci - function(x,

Re: [R] Efficient way of creating a shifted (lagged) variable?

2011-08-04 Thread R. Michael Weylandt
If you start looking at the time series classes (xts, zoo, etc) they have very quick and flexible lag functions built in. Might this be a slightly more efficient solution for the homebrew implementation? OurLag - function(y, k=1) { t = y[,1,drop=F]; d = y[,-1,drop=F]; if (is.matrix(y))

[R] use of modMCMC

2011-08-04 Thread Paola Lecca
Dear all, I used modFit of the package FME to fit a set of ODE to a ste of experimental data. The summary of this fit give me the following error summary(Fit) Residual standard error: 984.1 on 452 degrees of freedom Error in cov2cor(x$cov.unscaled) : 'V' is not a square numeric matrix In

Re: [R] special recursive filter

2011-08-04 Thread R. Michael Weylandt
More than happy to help. I think the term is sparse matrix. I haven't totally wrapped my mind around why your version seems to work (and testing it, it does seem to work for non-sparse matrices as well), but still, if it makes sense to you, why bother with adding one to the sum and the if

Re: [R] identifying weeks (dates) that certain days (dates) fall into

2011-08-04 Thread R. Michael Weylandt
You are getting 105 because the default behavior of findInterval is such that v[N+1] := + Inf (as noted in ? findInterval); that is, the last interval is actually taken to stretch from the final element of sbwl.dates unto eternity. It shouldn't be hard to write a catch line to set that to

Re: [R] identifying weeks (dates) that certain days (dates) fall into

2011-08-04 Thread Dimitri Liakhovitski
Michael, thanks a lot! Really appreciate it - what wasn't hard for you would be for me! Dimitri On Thu, Aug 4, 2011 at 2:20 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: You are getting 105 because the default behavior of findInterval  is such that v[N+1] := + Inf (as noted in ?

[R] survival probability estimate method

2011-08-04 Thread array chip
Hi, I was reading a paper published in JCO Prediction of risk of distant recurrence using 21-gene recurrence score in node-negative and node-positive postmenopausal patients with breast cancer treated with anastrozole or tamoxifen: a TransATAC study (ICO 2010 28: 1829). The author uses a method

Re: [R] Efficient way of creating a shifted (lagged) variable?

2011-08-04 Thread Dimitri Liakhovitski
Thanks a lot, guys! It's really helpful. But - to be objective- it's still quite a few lines longer than in SPSS. Dimitri On Thu, Aug 4, 2011 at 2:36 PM, Daniel Nordlund djnordl...@frontier.com wrote: -Original Message- From: r-help-boun...@r-project.org

Re: [R] Efficient way of creating a shifted (lagged) variable?

2011-08-04 Thread R. Michael Weylandt
But quite a few thousand dollars cheaper - seems a fair trade to me! Seriously though: your last few requests have been focused on time objects, so I strongly suggest you take a look at xts/zoo ( http://cran.r-project.org/web/packages/xts/index.html) -- it will make time objects much easier for

[R] Multiple endpoint (possibly group sequential) sample size calculation

2011-08-04 Thread Paul Miller
Hello everyone, I need to do a sample size calculation. The study two arms and two endpoints. The two arms are two different cancer drugs and the two endpoints reflect efficacy (based on progression free survival) and toxicity. Until now, I have been trying to understand this in terms of a

Re: [R] General indexing in multidimensional arrays

2011-08-04 Thread Gene Leynes
I'm just wondering When I use your function on your data I get a result that is not very intuitive. Is this what you were trying to do? (I took the liberty of setting dims to 3 since 'auto', 1, and 2 didn't work. data- array(rnorm(64),dim=c(4,4,4)) indices-

Re: [R] Efficient way of creating a shifted (lagged) variable?

2011-08-04 Thread Daniel Nordlund
-Original Message- From: Dimitri Liakhovitski [mailto:dimitri.liakhovit...@gmail.com] Sent: Thursday, August 04, 2011 11:47 AM To: Daniel Nordlund; r-help Subject: Re: [R] Efficient way of creating a shifted (lagged) variable? Thanks a lot, guys! It's really helpful. But - to be

[R] Automatic creation of binary logistic models

2011-08-04 Thread Paul Smith
Dear All, Suppose that you are trying to create a binary logistic model by trying different combinations of predictors. Has R got an automatic way of doing this, i.e., is there some way of automatically generating different tentative models and checking their corresponding AIC value? If so, could

Re: [R] labelling a stacked barchart (lattice)

2011-08-04 Thread Weidong Gu
Marc, Try this one barchart(data=dta, ~x, group=y, stack=T,col=sort(brewer.pal(7,Purples)), xlab=Percent, box.width=.5, scales=list(tick.number=10), panel=function(x,y,...){ panel.barchart(x,y,...) panel.text(cumsum(x)-dta$x/2,y,labels=dta$x)

Re: [R] Automatic creation of binary logistic models

2011-08-04 Thread Jeremy Miles
Sounds like you want a best subsets regression, the bestglm() function, found in the bestglm() package will do the trick. Jeremy On 4 August 2011 12:23, Paul Smith phh...@gmail.com wrote: Dear All, Suppose that you are trying to create a binary logistic model by trying different

[R] Sweave - landscape figure

2011-08-04 Thread Eduardo M. A. M. Mendes
Dear R-users I am trying to understand how Sweave works by running some simple examples. In the example I am working with there is a chunk where the R-commands related to plotting a figure are placed. When running R CMD Sweave … , pdflatex the output is a portrait figure. I wonder whether

Re: [R] General indexing in multidimensional arrays

2011-08-04 Thread R. Michael Weylandt
Hi Jannis, Like Gene, I'm not entirely sure what your code is intended to do, but it wasn't hard to adapt mine to at least print out the desired slice through the higher-dimensional array: cubeValues - function(Insert, Destination, Location) { Location = as.matrix(Location) Location =

Re: [R] Efficient way of creating a shifted (lagged) variable?

2011-08-04 Thread Joshua Wiley
On Aug 4, 2011, at 11:46, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Thanks a lot, guys! It's really helpful. But - to be objective- it's still quite a few lines longer than in SPSS. Not once you've sources the function! For the simple case of a vector, try: X - 1:10

Re: [R] Sweave - landscape figure

2011-08-04 Thread Duncan Murdoch
On 04/08/2011 3:40 PM, Eduardo M. A. M. Mendes wrote: Dear R-users I am trying to understand how Sweave works by running some simple examples. In the example I am working with there is a chunk where the R-commands related to plotting a figure are placed. When running R CMD Sweave … ,

[R] input equivalent of capture.output

2011-08-04 Thread Antonio Piccolboni
Hi, I am looking for the equivalent of capture.output for stdin. Imagine I am writing a test for a function that reads from stdin, say scan. 1: foobar 2: Read 1 item [1] foobar (please don't reply that scan can also read from a file, that's not what I am trying to test; let's say I found a bug

Re: [R] survival probability estimate method

2011-08-04 Thread Peter Jepsen
Dear John I am not aware of an R package that does this, but I believe that Patrick Royston's -stpm- function for Stata does. Here's two references found in http://www.stata-journal.com/sjpdf.html?articlenum=st0001_2: Royston, P. 2001. Flexible parametric alternatives to the Cox model. Stata

Re: [R] Limited number of principal components in PCA

2011-08-04 Thread William Armstrong
David and Josh, Thank you for the suggestions. I have attached a file ('q_values.txt') that contains the values of the 'Q' variable. David -- I am attempting an 'S' mode PCA, where the columns are actually the cases (different stream gaging stations) and the rows are the variables (the maximum

Re: [R] Sweave - landscape figure

2011-08-04 Thread Marc Schwartz
On Aug 4, 2011, at 2:40 PM, Eduardo M. A. M. Mendes wrote: Dear R-users I am trying to understand how Sweave works by running some simple examples. In the example I am working with there is a chunk where the R-commands related to plotting a figure are placed. When running R CMD Sweave

[R] How to see the previous commands after save workspace/load workspace ?

2011-08-04 Thread Bogdan Lataianu
I did save workspace and when I load it, I can see the variables, using ls(). But I cannot see the commands from the program I saved. How to do that? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

[R] Apply sensitivity library to dummy variables

2011-08-04 Thread Chih-Lin Chi
I am using SRC function in the sensitivity library. The independent variables (X) are a few dummy variables and the dependent variable (y) is numeric, ranged from 0,18 to 0.84. Example of independent variables are red coded as [0,0,0,1], green [0,0,1,0], blue [0,1,0,0], and yellow [1,0,0,0]. Error

Re: [R] Automatic creation of binary logistic models

2011-08-04 Thread Paul Smith
Wonderful! Thanks, Jeremy. Is bestglm() also able of trying nonlinear transformations of the variables, say log(X1) for instance? Paul On Thu, Aug 4, 2011 at 8:28 PM, Jeremy Miles jeremy.mi...@gmail.com wrote: Sounds like you want a best subsets regression, the bestglm() function, found in

[R] random value generation with added constraint.

2011-08-04 Thread Vijayan Padmanabhan
Hi I am looking at generating a random dataset of say 100 values fitting in a normal distribution of a given mean and SD, I am aware of rnorm function. However i am trying to build into this function one added constraint that all the random value generated should also obey the constraint that they

Re: [R] Efficient way of creating a shifted (lagged) variable?

2011-08-04 Thread Dimitri Liakhovitski
Thanks a lot for the recommendations - some of them I am implementing already. Just a clarification: the only reason I try to compare things to SPSS is that I am the only person in my office using R. Whenever I work on an R code my goal is not just to make it work, but also to boast to the SPSS

Re: [R] random value generation with added constraint.

2011-08-04 Thread Duncan Murdoch
On 04/08/2011 12:03 PM, Vijayan Padmanabhan wrote: Hi I am looking at generating a random dataset of say 100 values fitting in a normal distribution of a given mean and SD, I am aware of rnorm function. However i am trying to build into this function one added constraint that all the random

Re: [R] Automatic creation of binary logistic models

2011-08-04 Thread Marc Schwartz
On Aug 4, 2011, at 2:23 PM, Paul Smith wrote: Dear All, Suppose that you are trying to create a binary logistic model by trying different combinations of predictors. Has R got an automatic way of doing this, i.e., is there some way of automatically generating different tentative models and

Re: [R] General indexing in multidimensional arrays

2011-08-04 Thread Jannis
Thanks, Gene, for your hint! I indeed did not check any possible situation and my function was not returning what I intened it to return. This updated version, however, should. I am sure there are much easier ways (or ready made functions) to do the same. ind.datacube = function( ##title

[R] Text annotation of a graph

2011-08-04 Thread Lisa
Dear All, I am trying to add some text annotation to a graph using matplot() as follows: vars - c(v1, v2, v3, v4, v5, v6, v7, v8, v8, v10) id - seq(5.000, 0.001, by = -0.001) sid - c(4.997, 3.901, 2.339, 0.176, 0.151, 0.101, 0.076, 0.051, 0.026, 0.001) rn - sample(seq(0, 0.6, by =

[R] randomForest partial dependence plot variable names

2011-08-04 Thread Katharine Miller
Hello, I am running randomForest models on a number of species. I would like to be able to automate the printing of dependence plots for the most important variables in each model, but I am unable to figure out how to enter the variable names into my code. I had originally thought to extract

Re: [R] General indexing in multidimensional arrays

2011-08-04 Thread Gene Leynes
(I was just about to send this before your last reply) As a more general tip, I find that using %in% is easier to understand than is.element and setdiff because it can be more universal, especially when combined with all and the !. To me the functions like setdiff are easier to read, but harder

Re: [R] How to see the previous commands after save workspace/load workspace ?

2011-08-04 Thread R. Michael Weylandt
Check out ?savehistory in utils. Also, I think most GUI's do this - I can certainly attest that RStudio does Michael Weylandt On Thu, Aug 4, 2011 at 11:55 AM, Bogdan Lataianu bodins...@gmail.comwrote: I did save workspace and when I load it, I can see the variables, using ls(). But I cannot

Re: [R] Multiple endpoint (possibly group sequential) sample size calculation

2011-08-04 Thread Marc Schwartz
On Aug 4, 2011, at 2:03 PM, Paul Miller wrote: Hello everyone, I need to do a sample size calculation. The study two arms and two endpoints. The two arms are two different cancer drugs and the two endpoints reflect efficacy (based on progression free survival) and toxicity. Until

[R] Multi-task SVM in R

2011-08-04 Thread Vishal Thapar
Hi, Does anyone know of a package that implements Multi-task SVM in R? I found one in Matlab : http://www.ece.umn.edu/users/cherkass/predictive_learning/Resources/MTL_Software_Description.pdf I was wondering if there is something similar in R? Thank you for your help. Sincerely, Vishal

Re: [R] General indexing in multidimensional arrays

2011-08-04 Thread Gene Leynes
This function you wrote is interesting, but I almost missed it since I didn't see a direct example! cubeValues(NULL, data, indices) cubeValues(1, data, indices) cubeValues(c(1,2), data, indices) (sorry if I'm beating a dead horse here) On Thu, Aug 4, 2011 at 2:58 PM, R. Michael Weylandt

[R] functions on rows or columns of two (or more) arrays

2011-08-04 Thread Jim Bouldin
I realize this should be simple, but even after reading over the several help pages several times, I still cannot decide between the myriad apply functions to address it. I simply want to apply a function to all the rows (or columns) of the same index from two (or more) identically sized arrays

Re: [R] survival probability estimate method

2011-08-04 Thread array chip
Hi all, the reference for this method was: “Flexible parametric proportional-hazards and proportional-odds models for censored survival data, with application to prognostic modeling and estimation of treatment effects” published in Stat Med (2002) 21: 2175   The abstract is:   Modelling of

  1   2   >