is_whitespace: Finds strings that are purely whitespace

Description Usage Arguments Value Author(s) See Also Examples

Description

Finds strings that consist purely of whitespace (note: not merely strings that contain whitespace)

Usage

1

Arguments

x

character vector, or data.frame

Value

data.frame with same structure as x, but with entries of mode logical, or character vector with entries of mode logical

Author(s)

Thomas P. Harte

See Also

gsub

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
   tab<- read.table(text='Name| Age|Salary|ID
            | |32k|1
            N/A| NA|21k|2
            Harry| NA|NA|NA',
           header=TRUE,
           sep="|",
           colClasses=c("character","character","character","integer")
       )
   tab
   col_classes(tab)
   # these two columns contain whitespace:
   tab[, 1]
   tab[, 2]

   res<- is_whitespace(tab)
   col_classes(res)
   res

tharte/tutils documentation built on Feb. 11, 2020, 9:17 a.m.