This function removes all the leading and the trailing whitespaces in data
w_spaces(traj, remove="Both", verbose=TRUE)
traj | [matrix (numeric)]: longitudinal data. Each row represents an individual trajectory (of observations). The columns show the observations at consecutive time points. |
---|---|
remove | [character]: Type of whitespace to remove. That is, "Left" (leading), (2) "Right" (trailing), or "Both" (both leading and trailing whitespaces). Default: "Both". |
verbose | to suppress output messages (to the console).
Default: |
A matrix with all whitespaces (if any) removed.
Given a matrix suspected to contain whitespaces, this function removes the type of the whitespaces specified and returns a cleaned data. ’Whitespaces’ are white characters often introduced into data during data entry, for instance by wrongly pressing the spacebar. For example, neither " A" nor "A " is the same as "A" because of the whitespaces that exist in them. They can also result from systematic errors in data recording devices.
https://en.wikipedia.org/wiki/Whitespace_character
#> [1] "7 leading whitespaces found/removed!"#> $NumberOfWhiteSpacesRemoved #> [1] 7 #> #> $CleanData #> location_ids X2001 X2002 X2003 X2004 X2005 X2006 X2007 X2008 X2009 #> 1 E01012628 3 0 1 2 1 0 1 4 0 #> 2 E01004768 9 6.44 2 4 7 5 1 3 1 #> 3 E01004803 4 3 0 10 m 3 6 6 8 #> 4 E01004804 7 3 9 3 2 3.9 6 3 2 #> 5 E01004807 2 3.92 5 5 6 4.36 3 5 4 #> 6 E01004808 8 5 8 4 1 5 6 1 1 #> 7 E01004788 2 4 2.72 2 2 4 1 3 0 #> 8 E01004790 10 9 17 13 15 13.63 13.98 19 9 #> 9 E01004805 8 5 sd 7 9 4 5.41 6 3 #> 10 E01004806 25 12 14 15 18 13 21 27 17 #>