How to use Linux commands in R

Greetings,
I would like to run several linux commands from within an R script, actually notebook. The reason for doing this is mainly for educational purposes. I would like capture the linux commads that would be normally used...

I know it seems like a noobie question but a quick search came up with nada.
I am considering: tar, bzip2, gz, But what commands would 'you' suggest to replace them?

1 Like

Take a look at ?system and ?system2 commands in R. I'm fairly certain they do what you want.

1 Like

Thank you M.
Will do.

a = system("echo This_is_the_output", intern = TRUE)
a
# [1] "This_is_the_output"

Hope it helps :slightly_smiling_face:

1 Like

Thanks for the example, Leon.
I appreciate it!

YW - It this solves your question, please mark it as a solution :slightly_smiling_face:

I didn't notice that you specifically after archiving commands. In that case there are also ?zip and ?tar commands in base R that will most likely cover your use-case.

1 Like