[R] throwaway() function

John Wiedenhoeft wiedenhoeft at gmx.net
Thu Jul 20 18:15:01 CEST 2006


Dear all,

I apologize if this is a FAQ (seems a bit like one, but I didn't find
anything).

I'm looking for an easy way to cut one value out of a vector and shorten
the vector accordingly. Something like:

x <- c(1, 1, 0, 6, 2)
throwaway(x[3])

which will return x = 1 1 6 2, with length(x) = 4. I know one could do
this by hand, but then one would have to create a second vector y in a
loop which has to be 1 shorter then x and then assign x <- y, as there
is no "anti-c()" function which shortens a vector (at least to my
knowledge).

Is there some kind of a throwaway() function in R?

Best regards,
John



More information about the R-help mailing list