Learn R Programming

expss (version 0.11.4)

vars: Get variables/range of variables by name/by pattern.

Description

  • vars returns data.frame with all variables by their names or by criteria (see criteria). There is no non-standard evaluation in this function by design so use quotes for names of your variables. This function is intended to get variables by parameter/criteria. The only exception with non-standard evaluation is %to%. You can use %to% inside vars or independently.

  • ..p returns data.frame with all variables which names satisfy supplied perl-style regular expression. Arguments for this function is quoted characters. It is a shortcut for vars(perl(pattern)).

  • ..f returns data.frame with all variables which names contain supplied pattern. Arguments for this function can be unquoted. It is a shortcut for vars(fixed(pattern)).

  • ..t returns data.frame with variables which names are stored in the supplied arguments. Expressions in characters in curly brackets are expanded. See text_expand.

  • ..[] returns data.frame with all variables by their names or by criteria (see criteria). Names at the top-level can be unquoted (non-standard evaluation). For standard evaluation of parameters you can surround them by round brackets. You can assign to this expression. If there are several names inside square brackets then each element of list/data.frame from right side will be assigned to appropriate name from left side. You can use item1 %to% item2 notation to get/create sequence of variables. If there are no arguments inside square brackets than from each item of RHS will be created separate variable in the parent frame. In this case RHS should be named list or data.frame.

  • ..$name sets/returns object which name is stored in the variable name. It is convenient wrapper around get/assign functions.

  • %to% returns range of variables between e1 and e2 (similar to SPSS 'to').

  • indirect/indirect_list are aliases for vars/vars_list.

Functions with word 'list' in name return lists of variables instead of dataframes.

Usage

vars(...)

vars_list(...)

indirect(...)

indirect_list(...)

e1 %to% e2

e1 %to_list% e2

..

..f(...)

..p(...)

..t(...)

Value

data.frame/list with variables

Format

An object of class parameter of length 1.

Arguments

...

characters names of variables or criteria/logical functions

e1

unquoted name of start variable (e. g. a_1)

e2

unquoted name of start variable (e. g. a_5)