1

If I run an R script which contains a system function call similar to :

x<-system("ls -t -r | tail -n 1") , 

x will be 0 if the command is executed properly, different than 0 if there is an error. How can I save the output from the terminal in R, while executing the script?

1 Answer 1

7

Set the intern attribute to true.

x<-system("ls -t -r | tail -n 1", intern=TRUE)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.