[R] Simple syntax question (I think)

2016-01-20 Thread Bert Gunter
Could someone please explain to me my mal-understanding of the following, which I expected to give the same results without errors. TIA. -- Bert > z <- list(x=1) > z[[2]] <- 3 > z $x [1] 1 [[2]] [1] 3 > list(x = 1)[[2]] <- 3 Error in list(x = 1)[[2]] <- 3 : target of assignment expands to

Re: [R] Simple syntax question (I think)

2016-01-20 Thread Marc Schwartz
> On Jan 20, 2016, at 12:26 PM, Bert Gunter wrote: > > Could someone please explain to me my mal-understanding of the > following, which I expected to give the same results without errors. > > TIA. > > -- Bert > >> z <- list(x=1) >> z[[2]] <- 3 >> z > $x > [1] 1 > >

Re: [R] Simple syntax question (I think)

2016-01-20 Thread Duncan Murdoch
On 20/01/2016 2:21 PM, Bert Gunter wrote: Thanks Marc. Actually, I think the cognate construction for a vector (which is what a list is also) is: > vector("numeric",2)[2] <- 3 Error in vector("numeric", 2)[2] <- 3 : target of assignment expands to non-language object but this works: >

Re: [R] Simple syntax question (I think)

2016-01-20 Thread Bert Gunter
Thanks Marc. Actually, I think the cognate construction for a vector (which is what a list is also) is: > vector("numeric",2)[2] <- 3 Error in vector("numeric", 2)[2] <- 3 : target of assignment expands to non-language object but this works: > "[<-"(vector("numeric",2),2,3) [1] 0 3 I would

Re: [R] Simple syntax question (I think)

2016-01-20 Thread William Dunlap via R-help
Note that the expression x[1] <- 10 is equivalent not to `[<-`(x, 1, value=10) but to x <- `[<-`(x, 1, value=10) so there is no conflict between your two expressions. Saying c(1,2,3) <- `[<-`(c(1,2,3), 1, value=10) is not allowed because there is no name to assign something to. There

Re: [R] Simple syntax question (I think)

2016-01-20 Thread Bert Gunter
Thanks to both Bill and Duncan for their help. As I said, my mal-understanding of the syntax. Best, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed,

Re: [R] Simple permutation question

2014-06-27 Thread David Reiner
Subject: Re: [R] Simple permutation question For your 2nd question (which also answers your first question) I use the permn function in the combinat package, this function is nice that in addition to generating all the permutations it will also, optionally, run a function on each permutation for you: t

Re: [R] Simple permutation question

2014-06-26 Thread Robert Latest
On Wed, 25 Jun 2014 14:16:08 -0700 (PDT) Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: The brokenness of your perm.broken function arises from the attempted use of sapply to bind matrices together, which is not something sapply does. perm.fixed - function( x ) { if ( length( x ) == 1 )

Re: [R] Simple permutation question

2014-06-26 Thread Greg Snow
For your 2nd question (which also answers your first question) I use the permn function in the combinat package, this function is nice that in addition to generating all the permutations it will also, optionally, run a function on each permutation for you: t(simplify2array( permn( c(A,B,C) ) ))

[R] Simple permutation question

2014-06-25 Thread Robert Latest
So my company has hired a few young McKinsey guys from overseas for a couple of weeks to help us with a production line optimization. They probably charge what I make in a year, but that's OK because I just never have the time to really dive into one particular time, and I have to hand it to the

Re: [R] Simple permutation question

2014-06-25 Thread Cade, Brian
It is called sample(,replace=F), where the default argument is sampling without replacement. Try x - c(A,B,C,D,E) sample(x) Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150 Centre Ave., Bldg. C Fort Collins, CO 80526-8818 email: ca...@usgs.gov

Re: [R] Simple permutation question

2014-06-25 Thread Ted Harding
I think Robert wants deterministic permutations. In the e1071 package -- load with library(e1071) -- there is a function permutations(): Description: Returns a matrix containing all permutations of the integers '1:n' (one permutation per row). Usage: permutations(n) Arguments: n:

Re: [R] Simple permutation question

2014-06-25 Thread David L Carlson
Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Cade, Brian Sent: Wednesday, June 25, 2014 3:39 PM To: Robert Latest Cc: r-help@r-project.org Subject: Re: [R] Simple permutation question It is called sample(,replace=F), where the default argument

Re: [R] Simple permutation question

2014-06-25 Thread Bert Gunter
and further... See ?Recall for how to do recursion in R. However, it is my understanding that recursion is not that efficient in R. A chain of function environments must be created, and this does not scale well. (Comments from real experts welcome here). Cheers, Bert Bert Gunter Genentech

Re: [R] Simple permutation question

2014-06-25 Thread David L Carlson
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David L Carlson Sent: Wednesday, June 25, 2014 4:02 PM To: Cade, Brian; Robert Latest Cc: r-help@r-project.org Subject: Re: [R] Simple permutation question Assuming you want all

Re: [R] Simple permutation question

2014-06-25 Thread Jeff Newmiller
The brokenness of your perm.broken function arises from the attempted use of sapply to bind matrices together, which is not something sapply does. perm.fixed - function( x ) { if ( length( x ) == 1 ) return( matrix( x, nrow=1 ) ) lst - lapply( seq_along( x ) , function( i ) {

Re: [R] Simple permutation question

2014-06-25 Thread Jeff Newmiller
sorry... editing on the fly... try: perm.fixed - function( x ) { if ( length( x ) == 1 ) return( matrix( x, nrow=1 ) ) lst - lapply( seq_along( x ) , function( i ) { cbind( x[ i ], perm.fixed( x[ -i ] ) ) } ) do.call( rbind,

Re: [R] Simple loop question

2014-03-29 Thread Noah Marconi
Here're a couple alternatives if you want to use the index instead of the variable name: # Reproducible data frame a1 - 1:15 a2 - letters[1:15] a3 - LETTERS[1:15] a4 - 15:1 a5 - letters[15:1] df - data.frame(a1, a2, a3, a4, a5) df # a1 a2 a3 a4 a5 # 1 1 a A 15 o # 2 2 b B 14 n # 3

[R] Simple loop question

2014-03-28 Thread Luana Marotta
Hi all, I'm trying to find out what is the equivalent in R for the following Stata code: Let's say I have the variables: a1, a2, a3, a4, a5 forvalues i = 1(1)5 { summary a`i' } That is, I want to know how to loop through variables in R. Thank you in advance, Luana [[alternative

Re: [R] Simple loop question

2014-03-28 Thread Jim Lemon
On 03/28/2014 05:27 PM, Luana Marotta wrote: Hi all, I'm trying to find out what is the equivalent in R for the following Stata code: Let's say I have the variables: a1, a2, a3, a4, a5 forvalues i = 1(1)5 { summary a`i' } That is, I want to know how to loop through variables in R. Hi

[R] simple postscript question

2013-10-14 Thread Troels Ring
Dear friends - following instructions via google I managed to have the following eps accepted well in words - but I cannot get a decent postscript print from Gswiew, latest edition. The ylab is printed only in half, the par(mar seems inconsequential. I hope you will forgive this simple

Re: [R] simple postscript question

2013-10-14 Thread David Winsemius
On Oct 14, 2013, at 8:52 AM, Troels Ring wrote: Dear friends - following instructions via google I managed to have the following eps accepted well in words - but I cannot get a decent postscript print from Gswiew, latest edition. The ylab is printed only in half, the par(mar seems

[R] simple subset question

2012-12-02 Thread Felipe Carrillo
 Hi, Consider the small dataset below, I want to subset by two variables in one line but it wont work...it works though if I subset separately. I have to be missing something obvious that I did not realize before while using subset.. fish - structure(list(IDWeek = c(27L, 28L, 29L, 30L, 31L, 32L,

Re: [R] simple subset question

2012-12-02 Thread Anthony Damico
shouldn't you just change b to x and winter to fish? :) On Sun, Dec 2, 2012 at 12:21 PM, Felipe Carrillo mazatlanmex...@yahoo.comwrote: Hi, Consider the small dataset below, I want to subset by two variables in one line but it wont work...it works though if I subset separately. I have to

Re: [R] simple subset question

2012-12-02 Thread David Winsemius
On Dec 2, 2012, at 9:21 AM, Felipe Carrillo wrote: Hi, Consider the small dataset below, I want to subset by two variables in one line but it wont work...it works though if I subset separately. I have to be missing something obvious that I did not realize before while using subset..

Re: [R] simple subset question

2012-12-02 Thread R. Michael Weylandt
On Sun, Dec 2, 2012 at 5:21 PM, Felipe Carrillo mazatlanmex...@yahoo.com wrote: Hi, Consider the small dataset below, I want to subset by two variables in one line but it wont work...it works though if I subset separately. I have to be missing something obvious that I did not realize before

Re: [R] simple subset question

2012-12-02 Thread Gerrit Eichner
Hi, Felipe, two typos? See below! On Sun, 2 Dec 2012, Felipe Carrillo wrote:  Hi, Consider the small dataset below, I want to subset by two variables in one line but it wont work...it works though if I subset separately. I have to be missing something obvious that I did not realize before

Re: [R] simple subset question

2012-12-02 Thread Felipe Carrillo
/rbdd_jsmp.aspx From: R. Michael Weylandt michael.weyla...@gmail.com To: Felipe Carrillo mazatlanmex...@yahoo.com Cc: r-help@r-project.org r-help@r-project.org Sent: Sunday, December 2, 2012 9:42 AM Subject: Re: [R] simple subset question On Sun, Dec 2, 2012 at 5:21 PM, Felipe Carrillo mazatlanmex

Re: [R] simple subset question

2012-12-02 Thread Felipe Carrillo
://www.fws.gov/redbluff/rbdd_jsmp.aspx From: arun smartpink...@yahoo.com To: Felipe Carrillo mazatlanmex...@yahoo.com Cc: R help r-help@r-project.org; R. Michael Weylandt michael.weyla...@gmail.com Sent: Sunday, December 2, 2012 10:29 AM Subject: Re: [R] simple subset question Hi, I am getting

Re: [R] simple subset question

2012-12-02 Thread R. Michael Weylandt
On Sun, Dec 2, 2012 at 6:46 PM, Felipe Carrillo mazatlanmex...@yahoo.com wrote: Works with the small dataset (2 years) but I get the error message with the whole dataset (12 years of data). I am going to have to check what's wrong with it...Thanks Off the cuff guess: there's a NA in Total so

Re: [R] simple subset question

2012-12-02 Thread William Dunlap
michael.weyla...@gmail.com Cc: r-help@r-project.org r-help@r-project.org Sent: Sunday, December 2, 2012 1:25 PM Subject: Re: [R] simple subset question Sorry, I was trying it to subset from a bigger dataset called 'winter' and forgot to change the variable names when I asked the question

Re: [R] simple subset question

2012-12-02 Thread Felipe Carrillo
Cc: R help r-help@r-project.org Sent: Sunday, December 2, 2012 11:00 AM Subject: RE: [R] simple subset question I am still getting an error message with :   x - subset(fish,Year==2012 Total==max(Total));x I get: [1] IDWeek Total  Fry    Smolt  FryEq  Year 0 rows (or 0-length row.names

Re: [R] simple subset question

2012-12-02 Thread David Winsemius
: RE: [R] simple subset question I am still getting an error message with : x - subset(fish,Year==2012 Total==max(Total));x I get: [1] IDWeek Total FrySmolt FryEq Year 0 rows (or 0-length row.names) The above is not an error message. It says that there are no rows satisfying your

Re: [R] simple subset question

2012-12-02 Thread Felipe Carrillo
/redbluff/rbdd_jsmp.aspx From: David Winsemius dwinsem...@comcast.net To: Felipe Carrillo mazatlanmex...@yahoo.com Cc: William Dunlap wdun...@tibco.com; arun smartpink...@yahoo.com; R help r-help@r-project.org Sent: Sunday, December 2, 2012 11:54 AM Subject: Re: [R] simple subset question

Re: [R] simple subset question

2012-12-02 Thread arun
-help@r-project.org r-help@r-project.org Sent: Sunday, December 2, 2012 1:25 PM Subject: Re: [R] simple subset question Sorry, I was trying it to subset from a bigger dataset called 'winter' and forgot to change the variable names when I asked the question. David W suggestion works but the strange

Re: [R] simple subset question

2012-12-02 Thread arun
...@tibco.com; arun smartpink...@yahoo.com Cc: R help r-help@r-project.org Sent: Sunday, December 2, 2012 2:34 PM Subject: Re: [R] simple subset question Using my whole dataset I get: library(plyr) ddply(winter,Year,summarise,maxTotal=max(Total))  fish - structure(list(Year = 2002:2012, maxTotal = c

Re: [R] simple subset question

2012-12-02 Thread Felipe Carrillo
mazatlanmex...@yahoo.com Cc: William Dunlap wdun...@tibco.com; David Winsemius dwinsem...@comcast.net; R help r-help@r-project.org Sent: Sunday, December 2, 2012 1:18 PM Subject: Re: [R] simple subset question Hi, From the ddply() output, you could get the whole row by:  fish1 - structure(list(Year

Re: [R] simple subset question

2012-12-02 Thread David L Carlson
From: arun smartpink...@yahoo.com To: Felipe Carrillo mazatlanmex...@yahoo.com Cc: William Dunlap wdun...@tibco.com; David Winsemius dwinsem...@comcast.net; R help r-help@r-project.org Sent: Sunday, December 2, 2012 1:18 PM Subject: Re: [R] simple subset question Hi, From

Re: [R] simple subset question

2012-12-02 Thread Felipe Carrillo
PM Subject: RE: [R] simple subset question As David W. guessed. The maximum is in year 2005 not 2012 so no row from 2012 matches the maximum. subset(winter,Year==2012 Total==max(Total)) [1] IDWeek Total  Fry    Smolt  FryEq  Year  0 rows (or 0-length row.names) winter[which(winter$Total==max

[R] simple parsing question?

2012-10-11 Thread Fuchs Ira
I am using the getQuote function in the Quantmod package to retrieve the % change for a stock as follows: getQuote(aapl,what=yahooQF(c(Change Percent (Real-time Trade Time %Change (RT) aapl 2012-10-11 03:41:00 N/A - -1.67% How can I extract the numeric change % which is being

Re: [R] simple parsing question?

2012-10-11 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Fuchs Ira Sent: Thursday, October 11, 2012 12:58 PM To: r-help@r-project.org Subject: [R] simple parsing question? I am using the getQuote function in the Quantmod package to retrieve

Re: [R] simple parsing question?

2012-10-11 Thread Fuchs Ira
Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Fuchs Ira Sent: Thursday, October 11, 2012 12:58 PM To: r-help@r-project.org Subject: [R] simple parsing question? I am using the getQuote function in the Quantmod package to retrieve

Re: [R] simple parsing question?

2012-10-11 Thread William Dunlap
; William Dunlap Subject: Re: [R] simple parsing question? HI, Try this:  sprintf(%.2f,as.numeric(sub(^.* ([-+]?[[:digit:].]+)%$, \\1, as.character(aapl[[2]] #[1] -2.00 A.K. - Original Message - From: Fuchs Ira irafu...@gmail.com To: r-help@r-project.org Cc: Sent

Re: [R] simple parsing question?

2012-10-11 Thread arun
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Fuchs Ira Sent: Thursday, October 11, 2012 12:58 PM To: r-help@r-project.org Subject: [R] simple parsing question? I am using the getQuote function in the Quantmod package to retrieve

Re: [R] simple parsing question?

2012-10-11 Thread Fuchs Ira
] On Behalf Of Fuchs Ira Sent: Thursday, October 11, 2012 12:58 PM To: r-help@r-project.org Subject: [R] simple parsing question? I am using the getQuote function in the Quantmod package to retrieve the % change for a stock as follows: getQuote(aapl,what=yahooQF(c(Change Percent (Real-time

[R] simple data.frame question

2012-05-16 Thread Troels Ring
Dear friends - I hope you will forgive me another simple question, illustrated by ID - c(1,1,1,2,2,3,3,3) PERIOD - c(1,2,3,2,3,1,2,3) X - runif(8,0,10)) FF - data.frame(ID=ID,PERIOD=PERIOD,X=X) I need to the fourth value of X as NA, and ID and PERIOD is updated to 1,1,1,2,2,2,3,3,3 and

Re: [R] simple data.frame question

2012-05-16 Thread David Winsemius
On May 16, 2012, at 11:56 AM, Troels Ring wrote: Dear friends - I hope you will forgive me another simple question, illustrated by ID - c(1,1,1,2,2,3,3,3) PERIOD - c(1,2,3,2,3,1,2,3) X - runif(8,0,10)) Extraneous paren removed: FF - data.frame(ID=ID,PERIOD=PERIOD,X=X) I need to the

Re: [R] simple data.frame question

2012-05-16 Thread Troels Ring
Thanks a lot - beautiful Troels Den 16-05-2012 19:29, David Winsemius skrev: On May 16, 2012, at 11:56 AM, Troels Ring wrote: Dear friends - I hope you will forgive me another simple question, illustrated by ID - c(1,1,1,2,2,3,3,3) PERIOD - c(1,2,3,2,3,1,2,3) X - runif(8,0,10))

Re: [R] simple data.frame question

2012-05-16 Thread arun
  2  2 4.29322683 6  2  3 5.09269667 7  3  1 4.07936332 8  3  2 7.41808455 9  3  3 0.01558664 A.K. - Original Message - From: Troels Ring tr...@gvdnet.dk To: r-help@r-project.org Cc: Sent: Wednesday, May 16, 2012 11:56 AM Subject: [R] simple data.frame question

[R] simple ggplot2 question

2011-12-23 Thread Albert-Jan Roskam
Hello, I am trying to make a plot using the code below. The plot is divided into two parts, using facet_grid. I would like the vertical axis (labelled 'place') to be different for each location (=part). So in the upper part, only places 'n' through 'z' are shown, while in the lower part, only

Re: [R] simple ggplot2 question

2011-12-23 Thread Paul Hiemstra
On 12/23/2011 08:26 AM, Albert-Jan Roskam wrote: Hello, I am trying to make a plot using the code below. The plot is divided into two parts, using facet_grid. I would like the vertical axis (labelled 'place') to be different for each location (=part). So in the upper part, only places 'n'

Re: [R] simple lm question

2011-12-03 Thread Worik R
Sigh Please note that your df and M are undoubtedly different objects by now: Right. Not my most coherent day. thanks W M - matrix(runif(5*20), nrow=20) colnames(M) - c('a', 'b', 'c', 'd', 'e') l1 - lm(e~., data=as.data.frame(M)) l1 Call: lm(formula = e ~ ., data =

Re: [R] simple lm question

2011-12-02 Thread Worik R
Use `lm` the way it is designed to be used, with a data argument: l2 - lm(e~. , data=as.data.frame(M)) summary(l2) Call: lm(formula = e ~ ., data = as.data.frame(M)) And what is the regression being done in this case? How are the independent variables used? It looks like

Re: [R] simple lm question

2011-12-02 Thread R. Michael Weylandt
In your code by supplying a vector M[,e] you are regressing e against all the variables provided in the data argument, including e itself -- this gives the very strange regression coefficients you observe. R has no way to know that that's somehow related to the e it sees in the data argument. In

Re: [R] simple lm question

2011-12-02 Thread Worik R
Duh! Silly me! But my confusion persits: What is the regression being done? See below On Sat, Dec 3, 2011 at 5:10 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: In your code by supplying a vector M[,e] you are regressing e against all the variables provided in the data

Re: [R] simple lm question

2011-12-02 Thread David Winsemius
On Dec 2, 2011, at 11:20 PM, Worik R wrote: Duh! Silly me! But my confusion persits: What is the regression being done? See below Sigh Please note that your df and M are undoubtedly different objects by now: M - matrix(runif(5*20), nrow=20) colnames(M) - c('a', 'b', 'c',

[R] simple lm question

2011-12-01 Thread Worik R
I really would like to be able to read about this in a document but I cannot find my way around the documentation properly Given the code... M - matrix(runif(5*20), nrow=20) colnames(M) - c('a', 'b', 'c', 'd', 'e') ind - c(1,2,3,4) dep - 5 I can then do... l2 - lm(M[,dep]~M[,ind]) ## Clearly

Re: [R] simple lm question

2011-12-01 Thread David Winsemius
On Dec 1, 2011, at 10:50 PM, Worik R wrote: I really would like to be able to read about this in a document but I cannot find my way around the documentation properly Given the code... M - matrix(runif(5*20), nrow=20) colnames(M) - c('a', 'b', 'c', 'd', 'e') ind - c(1,2,3,4) dep - 5 I can

Re: [R] simple plot question

2011-08-10 Thread Maxim
Hi, thanks a lot for pointing me at conditional plotting! I have to confess that I'm still not really convinced whether this type of philosophy holds true in each and every situation, especially when there appears to be a common sense in literature (even if it is not optimal) to depict such data

[R] simple plot question

2011-08-09 Thread Maxim
Hi, please excuse the most likely very trivial question, but I'm having no idea where to find related information: I try to recapitulate very simple plotting behavior of Excel within R but have no clue how to get where I want. I have tab delimited data like cell treatment value line a treat1 4

Re: [R] simple plot question

2011-08-09 Thread R. Michael Weylandt
Hi Maxim, I notice no one has replied to you (on list at least) so I'll take a stab at answering your question and giving some productive advice. I believe the axis command will do what you want with a little tweaking: It certainly lines things up for me. x -

Re: [R] simple save question

2011-07-21 Thread cherron
Hi David and Tom I was having the same problem and was reading through your threads. I finally tried: summary(fit, rmean=TRUE)$table[5] This produced the mean. Hope this works for you as well. Casey -- View this message in context:

Re: [R] simple save question

2011-07-13 Thread Tom La Bone
Well, that took a bit of detective work! Thanks. I am still not doing something right here in my efforts to implement the easy way. Can you point out my error? library(survival) library(ISwR) dat.s - Surv(melanom$days,melanom$status==1) fit - survfit(dat.s~1) print(fit, print.rmean=TRUE)

Re: [R] simple save question

2011-07-13 Thread David Winsemius
On Jul 13, 2011, at 7:34 AM, Tom La Bone wrote: Well, that took a bit of detective work! It was a lot more work to do it my way than doing it the right way, which would have been to read the help page more carefully. Thanks. I am still not doing something right here in my efforts to

Re: [R] simple save question

2011-07-13 Thread Tom La Bone
No cigar. This is what I get and my session info. Any suggestions? library(survival) library(ISwR) dat.s - Surv(melanom$days,melanom$status==1) fit - survfit(dat.s~1) print(fit, print.rmean=TRUE) Call: survfit(formula = dat.s ~ 1) records n.maxn.start events *rmean

Re: [R] simple save question

2011-07-13 Thread David Winsemius
On Jul 13, 2011, at 11:16 AM, Tom La Bone wrote: No cigar. This is what I get and my session info. Any suggestions? First think ... try this sfit - summary(fit, rmean = individual) sfit$table[5] Hmmm. Second think. I suppose it's also possible that some of my unsuccessful efforts last

Re: [R] simple save question

2011-07-13 Thread Sarah Goslee
Just an observation, since this email has no indication of what you're trying to get at and I'm not inspired to dig back through the list: On Wed, Jul 13, 2011 at 11:16 AM, Tom La Bone boo...@gforcecable.com wrote: No cigar. This is what I get and my session info. Any suggestions?

Re: [R] simple save question

2011-07-13 Thread Tom La Bone
I want to assign the value of rmean from a survfit object to a variable so that it can be used in subsequent calculations, which is also what I interpreted the original poster to want. I did not understand Dr. Therneau's answer to the original poster, so I figured I would provide a simple example

Re: [R] simple save question

2011-07-13 Thread David Winsemius
On Jul 13, 2011, at 1:10 PM, Tom La Bone wrote: I want to assign the value of rmean from a survfit object to a variable so that it can be used in subsequent calculations, which is also what I interpreted the original poster to want. I did not understand Dr. Therneau's answer to the

Re: [R] simple save question

2011-07-12 Thread Tom La Bone
Here is a worked example. Can you point out to me where in temp rmean is stored? Thanks. Tom library(survival) library(ISwR) dat.s - Surv(melanom$days,melanom$status==1) fit - survfit(dat.s~1) plot(fit) summary(fit) Call: survfit(formula = dat.s ~ 1) time n.risk n.event survival

Re: [R] simple save question

2011-07-12 Thread David Winsemius
On Jul 12, 2011, at 2:31 PM, Tom La Bone wrote: Here is a worked example. Can you point out to me where in temp rmean is stored? Thanks. It is not. You need to read the ?print.survfit page: Value x, with the invisible flag set to prevent printing. (The default for all print functions

Re: [R] simple save question

2011-07-12 Thread Tom La Bone
Thank you for the reply Dr. Winsemius. Can you take your answer a step further and, in the context of the simple, reproducible example, illustrate how it is done? I would appreciate it. Tom -- View this message in context:

Re: [R] simple save question

2011-07-12 Thread David Winsemius
On Jul 12, 2011, at 5:43 PM, Tom La Bone wrote: Thank you for the reply Dr. Winsemius. Can you take your answer a step further and, in the context of the simple, reproducible example, illustrate how it is done? I would appreciate it. Of course. Would be happy to take a stab at it but

Re: [R] simple save question

2011-07-12 Thread David Winsemius
On Jul 12, 2011, at 5:43 PM, Tom La Bone wrote: Thank you for the reply Dr. Winsemius. Can you take your answer a step further and, in the context of the simple, reproducible example, illustrate how it is done? I would appreciate it. Tom The easy way is: sfit - summary(fit)

[R] Simple R Question...

2011-05-21 Thread Lars Bishop
Let's say I have the data frame 'dd' below. I'd like to select one column from this data frame (say 'a') and keep its name in the resulting data frame. That can be done as in #2. However, what if I want to make my selection based on a vector of names (and again keep those names in the resulting

Re: [R] Simple R Question...

2011-05-21 Thread Jim Holtman
dd[[ myname]] Sent from my iPad On May 21, 2011, at 7:37, Lars Bishop lars...@gmail.com wrote: Let's say I have the data frame 'dd' below. I'd like to select one column from this data frame (say 'a') and keep its name in the resulting data frame. That can be done as in #2. However, what if I

Re: [R] Simple R Question...

2011-05-21 Thread Jeff Newmiller
Or dd[,myname] should work too. If you are worried about getting multiple columns, you can just make myname a vector of column names using c() before you use either Jim's list indexing or the above matrix indexing syntax.

Re: [R] Simple R Question...

2011-05-21 Thread Patrick Burns
Are you looking for: dd[, a, drop=FALSE] On 21/05/2011 12:37, Lars Bishop wrote: Let's say I have the data frame 'dd' below. I'd like to select one column from this data frame (say 'a') and keep its name in the resulting data frame. That can be done as in #2. However, what if I want to make my

Re: [R] Simple R Question...

2011-05-21 Thread David Winsemius
On May 21, 2011, at 7:37 AM, Lars Bishop wrote: Let's say I have the data frame 'dd' below. I'd like to select one column from this data frame (say 'a') and keep its name in the resulting data frame. That can be done as in #2. However, what if I want to make my selection based on a vector of

[R] simple maths question

2011-04-11 Thread Georg Ehret
Hi Mrs Ms R, A simple maths question that I am trying to resolve with R: I need to calculate the SE from a pvalue and it's beta... How to do this...? Thank you very much and best regards! Georg Ehret, Geneva, Switzerland. [[alternative HTML version deleted

Re: [R] simple maths question

2011-04-11 Thread Ben Bolker
Georg Ehret georgehret at gmail.com writes: Hi Mrs Ms R, A simple maths question that I am trying to resolve with R: I need to calculate the SE from a pvalue and it's beta... How to do this...? Thank you very much and best regards! Georg Ehret, Geneva, Switzerland. Without more

Re: [R] simple save question

2011-04-06 Thread Terry Therneau
--- begin inclusion-- Hi, When I run the survfit function, I want to get the restricted mean value and the standard error also. I found out using the print function to do so, as shown below, The questions is, is there any way to extract these values from the print command? - end

[R] simple save question

2011-04-05 Thread xueke
Hi, When I run the survfit function, I want to get the restricted mean value and the standard error also. I found out using the print function to do so, as shown below, print(km.fit,print.rmean=TRUE) Call: survfit(formula = Surv(diff, status) ~ 1, type = kaplan-meier) records

Re: [R] Simple lattice question

2011-04-01 Thread Rubén Roa
-Mensaje original- De: Peter Ehlers [mailto:ehl...@ucalgary.ca] Enviado el: jueves, 31 de marzo de 2011 18:09 Para: Rubén Roa CC: r-help@r-project.org Asunto: Re: [R] Simple lattice question On 2011-03-31 06:58, Rubén Roa wrote: Thanks Peters! Just a few minor glitches now

Re: [R] Simple lattice question

2011-04-01 Thread Peter Ehlers
On 2011-03-31 23:28, Rubén Roa wrote: -Mensaje original- De: Peter Ehlers [mailto:ehl...@ucalgary.ca] Enviado el: jueves, 31 de marzo de 2011 18:09 Para: Rubén Roa CC: r-help@r-project.org Asunto: Re: [R] Simple lattice question On 2011-03-31 06:58, Rubén Roa wrote: Thanks Peters! Just

[R] Simple lattice question

2011-03-31 Thread Rubén Roa
DeaR ComRades, require(lattice) data - data.frame(SP=sort(rep(as.factor(c('A','B','C','D','E')),12)), x=rpois(60,10), y=rep(c(rep(0,4),rep(10,4),rep(20,4)),5), z=rep(1:4,15))

Re: [R] Simple lattice question

2011-03-31 Thread Peter Ehlers
On 2011-03-31 03:39, Rubén Roa wrote: DeaR ComRades, require(lattice) data- data.frame(SP=sort(rep(as.factor(c('A','B','C','D','E')),12)), x=rpois(60,10), y=rep(c(rep(0,4),rep(10,4),rep(20,4)),5), z=rep(1:4,15))

Re: [R] Simple lattice question

2011-03-31 Thread Rubén Roa
-Mensaje original- De: Peter Ehlers [mailto:ehl...@ucalgary.ca] Enviado el: jueves, 31 de marzo de 2011 15:41 Para: Rubén Roa CC: r-help@r-project.org Asunto: Re: [R] Simple lattice question On 2011-03-31 03:39, Rubén Roa wrote: DeaR ComRades, require(lattice) data

Re: [R] Simple lattice question

2011-03-31 Thread Peter Ehlers
: Re: [R] Simple lattice question On 2011-03-31 03:39, Rubén Roa wrote: DeaR ComRades, require(lattice) data- data.frame(SP=sort(rep(as.factor(c('A','B','C','D','E')),12)), x=rpois(60,10), y=rep(c(rep(0,4),rep(10,4),rep(20,4)),5

Re: [R] Simple lattice question

2011-03-31 Thread David Winsemius
On Mar 31, 2011, at 8:41 AM, Peter Ehlers wrote: On 2011-03-31 03:39, Rubén Roa wrote: DeaR ComRades, require(lattice) data- data.frame(SP=sort(rep(as.factor(c('A','B','C','D','E')),12)), x=rpois(60,10), y=rep(c(rep(0,4),rep(10,4),rep(20,4)),5),

[R] simple if question

2011-03-26 Thread Sebastián Daza
Hi everyone, I have just got different samples from a dataframe (independent and exclusive, there aren't common elements among them). I want to create a variable that indicate the sampling selection of the elements in the original dataframe (for example, 0 = no selected, 1= sample 1, 2=sample

Re: [R] simple if question

2011-03-26 Thread David Winsemius
On Mar 26, 2011, at 7:05 PM, Sebastián Daza wrote: Hi everyone, I have just got different samples from a dataframe (independent and exclusive, there aren't common elements among them). I want to create a variable that indicate the sampling selection of the elements in the original

Re: [R] simple if question

2011-03-26 Thread Thomas Levine
Posting some sample data would help, but I think something like this is what you want data[data$school=='Cornell University',] For example CO2[CO2$Type=='Quebec',] Tom 2011/3/26 Sebastián Daza sebastian.d...@gmail.com: Hi everyone, I have just got different samples from a dataframe

[R] Simple Boxplot Question- unexpected string constant error

2011-01-31 Thread MarquisDM
Hi everyone, Sorry for the newbie question but whenever I enter the following code into r it gives me an unexpected string constant in boxplot(Abs~Conc,ylab='Absorbency',xlab'Ethanol(%)' error. I have tried everything to eliminate it and have searched these forums to no avail, can anyone tell

Re: [R] Simple Boxplot Question- unexpected string constant error

2011-01-31 Thread David Winsemius
On Jan 31, 2011, at 9:39 PM, MarquisDM wrote: boxplot(Abs~Conc,ylab='Absorbency',xlab'Ethanol(%)') missing =..^. David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list

Re: [R] Simple Boxplot Question- unexpected string constant error

2011-01-31 Thread Dennis Murphy
Hi: Put an equals sign between xlab and ' Dennis On Mon, Jan 31, 2011 at 6:39 PM, MarquisDM mszentec...@gmail.com wrote: Hi everyone, Sorry for the newbie question but whenever I enter the following code into r it gives me an unexpected string constant in

Re: [R] simple plotting question

2010-12-13 Thread Anthony Damico
to add to Michael's response: http://www.statmethods.net/advgraphs/parameters.html On Mon, Dec 13, 2010 at 2:23 AM, Michael Bedward michael.bedw...@gmail.com wrote: Hello Erin, Try this... plot(x, y, type=b, pch=16) Michael On 13 December 2010 18:11, Erin Hodgess

[R] simple plotting question

2010-12-12 Thread Erin Hodgess
Dear R People: When I plot using type=b, I have circles and lines, which is as it should be. Is there a way to have filled in circles using the type argument, please? Or do I need to call the points function also, please? Thanks, Erin -- Erin Hodgess Associate Professor Department of

Re: [R] simple plotting question

2010-12-12 Thread Michael Bedward
Hello Erin, Try this... plot(x, y, type=b, pch=16) Michael On 13 December 2010 18:11, Erin Hodgess erinm.hodg...@gmail.com wrote: Dear R People: When I plot using type=b, I have circles and lines, which is as it should be. Is there a way to have filled in circles using the type

Re: [R] Simple qqplot question

2010-06-25 Thread Joris Meys
Sorry, missed the two variable thing. Go with the lm solution then, and you can tweak the plot yourself (the confidence intervals are easily obtained via predict(lm.object, interval=prediction) ). The function qq.plot uses robust regression, but in your case normal regression will do. Regarding

  1   2   >