x <- rnorm(100)
rp.label(x) # returns "x"
rp.label(x, FALSE) # returns NA and issues a warning
rp.label(mtcars$hp) <- "Horsepower"
rp.label(mtcars) # returns "Horsepower" instead of "hp"
rp.label(mtcars, FALSE) # returns NA where no labels are found
rp.label(sleep, FALSE) # returns NA for each variable and issues a warning
Run the code above in your browser using DataLab