I'm trying to run a compiled cpp file in my R program using system2(). The documentation for the cpp suggests that it's just one big command, so I'm thinking I'm not supposed to use the stdout or stder options in sys2.
- the required network.nodes and network.edges files are there in the /files folder
- I can run the system2() line but it doesn't output anything
- I previously compiled the socialrank.cpp and put it in the /exe folder using Cygwin or cmd prompt maybe (g++ -o socialrank socialrank.cpp)
Guidance: - To run the algorithm, simply run: ./socialrank summary_stats.txt graphname > debug.log (You need to have the files graphname.nodes and graphname.edges)
My code (let me know if you need to see more):
> nodelist %>% write_delim("./files/network.nodes", col_names = F)
> edgelist %>% write_delim("./files/network.edges", col_names = F)
> #system("../exe/socialrank ../files/summary_stats.txt ../files/network") #I think this code is for macs??
> system2("./exe/socialrank ./files/summary_stats.txt ./files/network") #Is this how you correct relative file directories for Windows?
So nothing is being output into the /files folder. I can't tell if the CPP file is being run, not exporting files, or exporting them somewhere else?
Please let me know if you any suggestions on compiling, calling cpp programs, or the system2 function. I've also heard about the sys and processx packages, so not sure if there is a better way to call system files that perhaps works across operating systems?
Thank you so much for your help!!