Hi,
Is there a way to specify the last element of a vector, similar to end in
MATLAB?
v[end]
would be MATLAB for
v(length(v))
in R.
While `v(length(v))' does yield the last element, that approach fails in the
following,
rep(v, each=2)[-c(1,length(v))]
which is meant to duplicate all
Sorry -- I meant `v(end)' and `v[length(v)]' in the first examples of
my message.
Alan
On Sun, Apr 25, 2010 at 11:10 AM, Alan Lue alan@gmail.com wrote:
Hi,
Is there a way to specify the last element of a vector, similar to end in
MATLAB?
v[end]
would be MATLAB for
v(length(v))
in
Hi Alan,
Take a look at the following:
x - 1:10
x[length(x)]
[1] 10
tail(x)
[1] 5 6 7 8 9 10
tail(x, 1)
[1] 10
See ?tail for more information.
HTH,
Jorge
On Sun, Apr 25, 2010 at 2:10 PM, Alan Lue wrote:
Hi,
Is there a way to specify the last element of a vector, similar to end
On 4/25/2010 2:10 PM, Alan Lue wrote:
Hi,
Is there a way to specify the last element of a vector, similar to end in
MATLAB?
v[end]
would be MATLAB for
v(length(v))
in R.
While `v(length(v))' does yield the last element, that approach fails in the
following,
rep(v,
On Apr 25, 2010, at 2:22 PM, Chuck Cleland wrote:
On 4/25/2010 2:10 PM, Alan Lue wrote:
Hi,
Is there a way to specify the last element of a vector, similar to
end in
MATLAB?
v[end]
would be MATLAB for
v(length(v))
in R.
While `v(length(v))' does yield the last element, that
Those are great solutions. Thanks so much for your help.
Yours,
Alan
On Sun, Apr 25, 2010 at 11:43 AM, David Winsemius
dwinsem...@comcast.net wrote:
On Apr 25, 2010, at 2:22 PM, Chuck Cleland wrote:
On 4/25/2010 2:10 PM, Alan Lue wrote:
Hi,
Is there a way to specify the last element of
6 matches
Mail list logo