convertCase {eatGADS}R Documentation

Modify upper and lower case for strings.

Description

Convert a character vector, all character variables in a data.frame or selected variables in a GADSdat to upper ("uppper"), lower ("lower"), or first letter upper and everything else lower case ("upperFirst").

Usage

convertCase(x, case = c("lower", "upper", "upperFirst"), ...)

## S3 method for class 'GADSdat'
convertCase(x, case = c("lower", "upper", "upperFirst"), vars, ...)

Arguments

x

A character vector, data.frame, or GADSdat.

case

Character vector of length 1. What case should the strings be converted to? Available options are "lower", "upper", or "upperFirst".

...

further arguments passed to or from other methods.

vars

Character vector. What variables in the GADSdat should the conversion be applied to?

Value

Returns the converted object.

Methods (by class)

Examples

# for character
convertCase(c("Hi", "HEllo", "greaT"), case = "upperFirst")

# for GADSdat
input_g <- import_DF(data.frame(v1 = 1:3, v2 = c("Hi", "HEllo", "greaT"),
                          stringsAsFactors = FALSE))
convertCase(input_g, case = "upperFirst", vars = "v2")



[Package eatGADS version 1.1.0 Index]