[R] Method

William Dunlap wdunlap at tibco.com
Tue Nov 24 22:09:55 CET 2009


Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of David Winsemius
> Sent: Tuesday, November 24, 2009 12:22 PM
> To: yonosoyelmejor
> Cc: r-help at r-project.org
> Subject: Re: [R] Method
> 
> 
> On Nov 24, 2009, at 1:44 PM, yonosoyelmejor wrote:
> 
> >
> > I use length(myVector),but when i want to use for example
> > exp(x.reconstruida[length(myVector)+1:length(myVector)+9]), I need  

This may have nothing to do with your original problem,
but I suspect that expression should be
   exp(x.reconstruida[(length(myVector)+1):(length(myVector)+9)])
or, equivalently,
   exp(x.reconstruida[length(myVector)+(1:9)])
(where the parentheses around 1:9 are not required but often
helpful for understanding).

Compare
   > 5+1:5+10
   [1] 16 17 18 19 20
   > (5+1):(5+10)
    [1]  6  7  8  9 10 11 12 13 14 15

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> > that
> > function returns the number of last element,would then:
> >
> > if the last position of my vector is 1440
> >
> > exp(x.reconstruida[1440+1:1440+9]

Again, (1440+1):(1440+9) or 1440+(1:9).

> 
> So that should give you (assuming that you close the expression) a  
> vector of values, "e" raised to a vector from elements 1441 to 1449,  
> if such elements have already been defined and are numeric.
> >
> > This is what I need, I hope having explained,
> 
> I do not think you have explained well enough. What is  
> "x.reconstruida"? Does it have a longer length than myVector?
> 
> Things would be much clearer if you made a small example (not 1440  
> elements long, maybe 10?).
> 
> -- 
> David
> >
> > A gretting,
> > Ignacio.
> >
> > Johannes Graumann-2 wrote:
> >>
> >> myVector <- c(seq(10),23,35)
> >> length(myVector)
> >> myVector[length(myVector)]
> >>
> >> it's unclear to me which of the two you want ...
> >>
> >> HTH, Joh
> >>
> >> yonosoyelmejor wrote:
> >>
> >>>
> >>> Hello, i would like to ask you another question. Is exist  
> >>> anymethod to
> >>> vectors that tells me the last element?That is to say,I have a  
> >>> vector, I
> >>> want to return the position of last element. I hope having  
> >>> explained.
> >>>
> >>> A greeting,
> >>> Ignacio.
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >>
> >
> > -- 
> > View this message in context: 
> http://old.nabble.com/Method-tp26493442p26499919.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 




More information about the R-help mailing list