# NOT RUN {
test_dir <- file.path(tempdir(),'sinew_test')
dir.create(test_dir)
txt <- "#some comment
yy <- function(a=4){
head(runif(10),a)
# a comment
}
v <- 20
#another comment
zz <- function(v=10,a=3){
head(runif(v),pmin(a,v))
}
zz(v)
"
untangle(text = txt,dir.out = test_dir)
list.files(tempdir(), recursive = TRUE, pattern = '.R$')
cat( readLines(file.path(test_dir,'yy.R')), sep = '\n')
cat( readLines(file.path(test_dir,'zz.R')), sep = '\n')
cat( readLines(file.path(tempdir(),'body.R')), sep = '\n')
unlink(test_dir, force = TRUE, recursive = TRUE)
# }
Run the code above in your browser using DataLab