search for: prechomp

Displaying 1 result from an estimated 1 matches for "prechomp".

Did you mean: prcomp
2010 Mar 29
3
one way to write scripts in R
...p() does for you. ########################## # delete one trailing whitespace chomp=function(x) { n=nchar(x) a=substr(x,n,n) w=which(a==" " | a == "\n" | a=="\t") if (length(w)) { x[w]=substr(x[w],1,n[w]-1) } x } # delete one leading whitespace prechomp=function(x) { n=nchar(x) a=substr(x,1,1) w=which(a==" " | a == "\n" | a == "\t") if (length(w)) { x[w]=substr(x[w],2,n[w]) } x } # eliminate whitespace leading/trailing from a string trim=function(x) { y=chomp(x) while(any(y!=x)) { x...