getColumn(Air.Flow, stackloss)
getColumn(2, stackloss)
getColumn("2", stackloss) # works too...
is.error( getColumn(Acid, stackloss) , tell=TRUE)
is.error( getColumn(2:3, stackloss) , tell=TRUE)
upper <- function(x) getColumn(x, stackloss)
upper(Water.Temp)
upper(2)
# upper(Water) # error with useful message (design choice: partial matching not supported)
upper2 <- function(xx) {xx <- 17; getColumn(xx, stackloss)} # will break!
stopifnot(is.error( upper2(Water.Temp) )) # breaks
upper3 <- function(xx, dd) getColumn(substitute(xx), dd)
upper3(Air.Flow, stackloss) # may be safer in many scoping situations
# In packages use "colname" with quotation marks in level 2 functions to avoid
# the CRAN check NOTE "no visible binding for global variable"
df <- data.frame(x=letters[1:3],y=letters[4:6])
is.vector(df$x)
is.vector(getColumn("x", df)) # FALSE
# cannot force output to be a vector, as this will convert:
as.Date("2016-09-14") ; as.vector(as.Date("2016-09-14"))
# same problem with dfs from tapply results
# better ideas welcome!! (berry-b@gmx.de)
Run the code above in your browser using DataLab