Description Usage Arguments Value Author(s) See Also Examples
Use system cut
(*NIX only). For large files this is much faster
than reading the file into R and cutting the columns.
1 | cut_system(cols, filename, sep = "|")
|
cols |
|
filename |
|
sep |
|
character
vector
output from cut
Thomas P. Harte
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | tab<- read.csv(text='Name,Age,Salary,ID
Dick,38,32k,1
Tom,21,21k,2
Harry,56,NA,3',
header=TRUE,
stringsAsFactors=FALSE
)
for (col in which(col_classes(tab)=="character"))
tab[, col]<- tutils::trim(tab[, col])
tab
filename<- paste(tempfile(), ".csv", sep="")
write.csv(tab, file=filename, row.names=FALSE, quote=FALSE)
cut_system(1, filename, sep=",")
cut_system(4, filename, sep=",")
cut_system(c(1,4), filename, sep=",")
unlink(filename)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.