system in R

 In R, system invokes the OS command specified by command.
# Now the output of the command will be written to 'stdout'
system_return_val <- system("ls ../")

cat("Retrun value of system is: ", system_return_val, "\n")
## Retrun value of system is:  0
# You can use parameter 'intern' to captur the output of the command as an R character vector
system_return_val <- system("ls ../", intern = TRUE)
cat("Retrun value of system with 'intern=T' is: ", system_return_val, "\n")
## Retrun value of system with 'intern=T' is:  donate home post publications_selected tags
intern: a logical (not ‘NA’) which indicates whether to capture the output of the command as an R character vector.

Comments

Popular posts from this blog

gspread error:gspread.exceptions.SpreadsheetNotFound

Miniconda installation problem: concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.

转载:彻底搞清楚promoter, exon, intron, and UTR