powered by
sn sets a vector's names as its elements. It is a simple utility function equal to setNames(x, nm = as.character(x)). This is particularly useful when using lapply and you want the return object to have X as its names.
sn
setNames(x, nm = as.character(x))
lapply
X
sn(x)
x with the elements of x as its names.
x
atomic or list vector.
sn(1:10) sn(c("one","two","three"))
Run the code above in your browser using DataLab