1

I have read a bit some other answer but this seems a bit different:

coddinggame_DEBUG takes several arguments. To invoke it in bash with fixed arguments I do:

cd /superdirectory/
./codinggame_DDEBUG <<'EOF'
testCases01.txt
1
4
EOF

and this works. The bash answers:

Enter File name (with extention): Enter seed (unsigned integer): Enter Line Number: Mean Sample:23.3821  Sd Sample:6.19504

(no warning and the Mean and Sd are computed correctly)

If I try to achieve the same through R:

x<-paste0('cd /superdirectory/  \n
./codinggame_DDEBUG <<"EOF"     \n
testCases01.txt                 \n
1                               \n
4                               \n
EOF                             \n
echo done')
cat(x)
system(x)

I get:

Enter File name (with extention): Enter seed (unsigned integer): Warning:1

e.g. The second argument ('1') is not passed properly which causes the code to stop there.

1 Answer 1

1

This works:

x<-paste0('cd /superdirectory/  \n
    >input.txt echo testCases01.txt                     \n
    >>input.txt echo 1                          \n
    >>input.txt echo 4                      \n
    ./codinggame_DDEBUG <input.txt                  \n
    echo done')
    cat(x)

system(x)
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.