Or perhaps even more parsimoniously (by a couple of characters) -

r <- c(1, 2, 3, 4, 5)
r2<-r[-length(r)]

Min-Han

On Sun, Apr 17, 2011 at 10:23 PM, Daisy Englert Duursma <
daisy.duursma@gmail.com> wrote:

> A easier solution:
>
> r <- c(1, 2, 3, 4, 5)
> r2<-r[1:length(r)-1]
>
>
>
>
> On Mon, Apr 18, 2011 at 10:51 AM, empyrean <ctross@ucdavis.edu> wrote:
> > Hey guys,
> >
> > I've search a few threads about deleting a value from a vector, but no
> one
> > has addressed this question so far.
> >
> > I want to delete the last value from a string of values
> >
> > I have:
> >
> > r = [ 1, 2, 3, 4, 5 ], and i want to make r2 = to [ 1, 2, 3, 4]
> >
> > So that r2 is just like r, except that it missing the final value.
> >
> > Thanks,
> >
> > --
> > View this message in context:
> http://r.789695.n4.nabble.com/Deleting-the-last-value-of-a-vector-tp3456363p3456363.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > R-help@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.
> >
>
>
>
> --
> Daisy Englert Duursma
> Department of Biological Sciences
> Room E8C156
> Macquarie University, North Ryde, NSW 210
> Australia
>
> Tel +61 2 9850 9256
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]

