aslength1 | R Documentation |
Subset the first element of a vector.
aslength1(x)
x |
vector (or an object which can be coerced) with at least one element. |
Vectors of length one return themselves. Vectors of length greater than one
return the first element with a warning. Vectors of length zero throw an
error. If x
is a vector (determined by is.vector
), names
will be preserved.
A vector of length 1.
aslength1(1)
aslength1(1:10)
try(aslength1(integer(0)))
print(system.file("R", "aslength1.Rd", package = "essentials"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.