varname | R Documentation |
detect variable/column names in source data set
varname(type, src, return.na = FALSE, possibilities = FALSE)
type |
character, one of |
src |
usually a data.frame |
return.na |
by default |
possibilities |
logical. If |
the case of "duration" is special, such a column is not mandatory and therefore might not be found either because it does not exist or because its column name is not among the templates provided in the function. In case no duration column is found, it is returned as NA
and a message is returned to inform the user about the possible ambiguity.
If type="IDs"
an attempt is made to figure out whether there is one of the two possibilities of combinations of ID columns, i.e. (1) a focal and a partner column or (2) a focal, actor and receiver column
character of variable name in the source data
x <- datagen() varname("date", x[[1]]) varname("focal", x[[1]]) ## Not run: varname("observer", x[[1]]) # error varname("observer", x[[1]], return.na=TRUE) # works and returns NA ## End(Not run) # return possible matches varname("observer", x[[1]], possibilities=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.