Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Getting make to work on Windows NOT through RStudio #58

Closed
daattali opened this issue Nov 6, 2014 · 12 comments
Closed

Getting make to work on Windows NOT through RStudio #58

daattali opened this issue Nov 6, 2014 · 12 comments
Assignees

Comments

@daattali
Copy link
Member

daattali commented Nov 6, 2014

After a couple hours of fighting with my machine, I was able to get the full pipeline from class to run on a Windows machine via shell (rather than using RStudio)

It is much easier to use RStudio, but using the shell is more powerful and you have more granular control over what targets to build. These are the steps you have to take if you want to build the sample Makefile from class in the Windows Command Prompt or git shell:

  • Find where Rscript lives on your machine and include it in your PATH (ie. C:\Program Files\R\R-3.1.0\bin. You need this so that all the Rscript commands will work
  • Find where pandoc lives on your machine and include it in your PATH (ie. C:\Program Files\RStudio\bin\pandoc). You need this to convert to/from markdown
  • Replace all " with \" in your Makefile. This unfortunately means that you won't be able to run the same Makefile both using RStudio and using a shell, because RStudio requires your Makefile to look "normal" but the windows shell needs them to be escaped. @sjackman @jennybc maybe there's a better solution for this?
  • If using RStudio or Windows Command Line, then replace all rm commands with del. If using Git Bash shell, leave the rm commands as-is

Hopefully I didn't forget a step. Now you can make clean all from the command line hopefully

@sjackman sjackman self-assigned this Nov 7, 2014
@sjackman
Copy link
Member

sjackman commented Nov 7, 2014

Find where pandoc lives on your machine and include it in your PATH (ie. C:\Program Files\RStudio\bin\pandoc). You need this to convert to/from markdown

We can get rid of the Pandoc dependency if we use rmarkdown::render rather than pandoc. Jenny, do you have a preference? @jennybc

@jennybc
Copy link
Member

jennybc commented Nov 7, 2014

Strong preference for rmarkdown::render().

@sjackman
Copy link
Member

sjackman commented Nov 7, 2014

Okay. I'll update the activity.

@sjackman
Copy link
Member

sjackman commented Nov 7, 2014

Replace all " with "\

Should that be \" rather than "\? @daattali

@jennybc
Copy link
Member

jennybc commented Nov 7, 2014

I'm editing it very actively in the branch FYI.

https://github.com/STAT545-UBC/STAT545-UBC.github.io/tree/split-automation-content

@sjackman
Copy link
Member

sjackman commented Nov 7, 2014

Replace all " with "\ in your Makefile.

This might be related to whether the shell is cmd.exe or sh.exe. I'd like to standardize on sh.exe so that everyone is using the same shell. We had trouble in class with people using sh.exe and were forced to use cmd.exe as a workaround.

@sjackman
Copy link
Member

sjackman commented Nov 7, 2014

If using RStudio or Windows Command Line, then replace all rm commands with del. If using Git Bash shell, leave the rm commands as-is

I'd prefer to use Git Bash (see above) to standardize the shell. Another options is to use Rscript -e 'file.remove(…)' instead of rm.

@sjackman
Copy link
Member

sjackman commented Nov 7, 2014

Thanks for your help troubleshooting, Dean!

@jennybc
Copy link
Member

jennybc commented Nov 7, 2014

I like @sjackman 's point about using file.remove(…). This is an under appreciated reason for doing stuff like this with a higher level language, such as R, where these OS-specific implementations have already been sorted out. Long term, yes people need to be comfortable in the shell. But when first starting out, it can be useful to do as much as possible with one tool. In our case, R.

@daattali
Copy link
Member Author

daattali commented Nov 7, 2014

@sjackman

  • yes, I'll edit my original post, it is \"
  • good point re: using R's file.remove instead of the command line, then we don't need OS-specific makefiles
  • re:pandoc - I was never using an explicit pandoc command in my makefile, I think it was necessary for the render function? I'm not sure

@sjackman
Copy link
Member

sjackman commented Nov 7, 2014

@jennybc If installing msysGit solves all the troubles with rm and other utility programs, I'd prefer to use rm over file.remove. What's your preference?

@jennybc
Copy link
Member

jennybc commented Nov 8, 2014

@sjackman Yes I concur it's looking like we should recommend installation of msysgit. I think it's good to show core shell commands like rm and cp.

It is nice to provide R-based workarounds as a Plan B, so people can complete the activity even if they are experiencing glitches with the Windows shell.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants