These articles contain guidance on how to incorporate Python into your data science workflow. They are not intended as general tips for all Python users, but rather as an articulation of what will work best if you primarily use R, occasionally use Python, and use RStudio's professional products.
REPL and shell#
An important workflow difference if you're coming from an R background is that most R work is done in the context of an interactive session, or REPL.
For example, to install a package in R, you can type the following:
dplyr package will be available for you to use.
By contrast, many of the Python commands you'll see in this collection are intended to be run from the shell.
For example, to install the Python package
pandas, you would type the following
$ python -m pip install pandas
Using the shell is discussed in an appendix of Happy Git With R.
The shell you are likely to be using depends on your operating system:
Environment variables are named values that programs look up when they start or while they're running. Variable names are capitalized by convention.
Setting environment variables#
Place lists of environment variables in an
.Renviron file. Read more about R startup in Chapter 7 of What They Forgot to Teach You About R.
python-dotenv package can be used to set environment variables from a
Getting environment variables#
Sys.getenv() in R,
os.getenv() in Python, or
printenv in the shell to get the value of an environment variable.
HOME, for example, is the directory where most of your files will usually live.