Description Usage Arguments Details Value Author(s) See Also Examples
Remove leading and trailing spaces from character strings and other related objects.
1 |
s |
object to be processed |
recode.factor |
should levels of a factor be recoded, see below |
... |
arguments passed to other methods, currently only to
|
trim
is a generic function, where default method does nothing,
while method for character s
trims its elements and method for
factor s
trims levels
. There are also methods for
list
and data.frame
.
Trimming character strings can change the sort order in some locales.
For factors, this can affect the coding of levels. By default, factor
levels are recoded to match the trimmed sort order, but this can be
disabled by setting recode.factor=FALSE
. Recoding is done with
reorder.factor
.
s
with all leading and trailing spaces removed in its elements.
Gregory R. Warnes greg@warnes.net with contributions by Gregor Gorjanc
trimws
, sub
,gsub
as well as argument strip.white
in read.table
and
reorder.factor
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to locate valid perl interpreter
gdata:
gdata: read.xls() will be unable to read Excel XLS and XLSX files
gdata: unless the 'perl=' argument is used to specify the location of a
gdata: valid perl intrpreter.
gdata:
gdata: (To avoid display of this message in the future, please ensure
gdata: perl is installed and available on the executable search path.)
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLX' (Excel 97-2004) files.
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLSX' (Excel 2007+) files.
gdata: Run the function 'installXLSXsupport()'
gdata: to automatically download and install the perl
gdata: libaries needed to support Excel XLS and XLSX formats.
Attaching package: 'gdata'
The following object is masked from 'package:stats':
nobs
The following object is masked from 'package:utils':
object.size
The following object is masked from 'package:base':
startsWith
[1] "this is an example string"
[1] " this is an example string " " C "
[3] " A" " B "
[5] "D "
[1] this is an example string this is an example string
[3] A B
[5] C D
Levels: A B C D this is an example string
[1] "A" "B"
[3] "C" "D"
[5] "this is an example string"
[1] this is an example string this is an example string
[3] A B
[5] C D
Levels: this is an example string C A B D
[1] "this is an example string" "C"
[3] "A" "B"
[5] "D"
$s
[1] "this is an example string" "this is an example string"
[3] "this is an example string" "this is an example string"
[5] "this is an example string" "this is an example string"
$f
[1] this is an example string this is an example string
[3] A B
[5] C D
Levels: A B C D this is an example string
$i
[1] 1 2 3 4 5 6
s f i
1 this is an example string this is an example string 1
2 this is an example string this is an example string 2
3 this is an example string A 3
4 this is an example string B 4
5 this is an example string C 5
6 this is an example string D 6
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.