Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

qc

Create vector of characters from unquoted strings (variable names)


Description

  • qc It is often needed to address variables in the data.frame in the such manner: dfs[ , c("var1", "var2", "var3")]. qc ("quoted c") is a shortcut for the such cases to reduce keystrokes. With qc you can write: dfs[ , qc(var1, var2, var3)].

  • qe returns list of expression. It is useful to create substitution list for ..$arg.

  • text_expand is simple string interpolation function. It searches in its arguments expressions in curly brackets {expr}, evaluate them and substitute with the result of evaluation. See examples.

Usage

qc(...)

qe(...)

text_expand(..., delim = c("\\{", "\\}"))

Arguments

...

characters in text_expand, unquoted names of variables in qc or unquoted expressions in qe.

delim

character vector of length 2 - pair of opening and closing delimiters for the templating tags. By default it is curly brackets. Note that delim will be used in the perl-style regular expression so you need to escape special characters, e. g. use "\\{" instead of "{".

Value

Vector of characters

Examples

## qc
qc(a, b, c)
identical(qc(a, b, c), c("a", "b", "c"))

mtcars[, qc(am, mpg, gear)]

## text_expand
i = 1:5
text_expand("q{i}")

i = 1:3
j = 1:3
text_expand("q1_{i}_{j}")

data(iris)
text_expand("'iris' has {nrow(iris)} rows.")

## qe
qe(mrset(a1 %to% a6), mrset(b1 %to% b6), mrset(c1 %to% c6))

expss

Tables, Labels and Some Useful Functions from Spreadsheets and 'SPSS' Statistics

v0.10.7
GPL (>= 2)
Authors
Gregory Demin [aut, cre], Sebastian Jeworutzki [ctb] (<https://orcid.org/0000-0002-2671-5253>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.