Description Usage Arguments Details Value Examples
This function inserts a tag or extension into a file name. It can also replace an element of a file name.
1 2 3 4 5 6 7 8 |
x |
file name ( |
... |
unused arguments |
tag |
one or more file name tags to insert |
tag.pos |
position at which to insert tag
( |
ext |
one or more file extension tags to insert |
ext.pos |
position at which to insert extension
( |
replace |
if |
By default, tags are inserted at the ultimate position and extensions
at the penultimate position, if possible.
(That is, the final file extension will not change, unless the insertion
position is specified otherwise or the orginal file name had no extension.)
If replace
is TRUE
, the tag at the indicated position is
replaced by the new tag instead.
modified object of the original type
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | f <- as.filename("data_expr_2014-05-01.tsv")
# new file name with inserted tags for saving normalized data
g <- insert(f, tag=c("mod", "norm"))
print(as.character(g))
# new file name with inserted extension for saving sorted data
h <- insert(f, ext="sorted")
print(as.character(h))
# new file name with different extension for saving in different format
i <- insert(f, ext="csv", replace=TRUE)
print(as.character(i))
# insert another tag
j <- insert(g, tag="qc", tag.pos=2)
print(as.character(j))
|
[1] "data_expr_mod_norm_2014-05-01.tsv"
[1] "data_expr_2014-05-01.sorted.tsv"
[1] "data_expr_2014-05-01.csv"
[1] "data_expr_qc_mod_norm_2014-05-01.tsv"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.