trim: Trim trailing blanks

Description Usage Arguments Details Value Examples

View source: R/fun.R

Description

Generic function to trim leading and trailing blanks from character vectors and factors.

Usage

1
trim(x)

Arguments

x

a data frame, factor, character or numeric vector

Details

The main application is in reading SPSS files that often have leading or trailing blanks in character and factor values. These blanks are often inconsistent so that values will appear to differ even though they are equal. The trim function is called in Read.spss to remove leading and trailing blanks from all factors.

Value

A character vector or factor with leading and trailing blanks removed.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (x) 
{
trim in fun.R
    UseMethod("trim")
  }

gmonette/spida documentation built on May 17, 2019, 7:25 a.m.