Learn R Programming

eatGADS (version 1.1.1)

convertCase: 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 GADSdat convertCase(x, case = c("lower", "upper", "upperFirst"), vars, ...)

Value

Returns the converted object.

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?

Methods (by class)

  • convertCase(GADSdat): convert case for GADSdats

Examples

Run this code
# 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")


Run the code above in your browser using DataLab