MATH/COSC 3570 Introduction to Data Science
R and Python are programming languages.
Posit Cloud offers two integrated development environments (IDE):
which are software for efficiently writing computer programs.
😎 Implement R/Python programs without needing to install R/Python and the IDE in your laptop!
😎 Posit Cloud lets you do, share and learn data science online for free!
Step 2: Click GET STARTED.
Step 3: Free or Student > Sign Up. Please sign up with GitHub if you have one or use your Marquette email address.
In the bar, click workspace 2024-spring-math-3570.
Click New Project > New RStudio Project to get into the IDE.
In Untitled Project, name your project as 3570-project.
In the Console pane, write R code: a string "Hello WoRld!"
or math 2 + 4
.
Tools > Global Options > Appearance to select your favorite editor theme.
A R script is a .R file that contains R code.
To create a R script, go to File > New > R Script, or click the green-plus icon on the topleft corner, and select R Script.
A Python script is a .py file that contains Python code.
To create a Python script, go to File > New > Python Script, or click the green-plus icon on the topleft corner, and select Python Script.
ctrl + enter
(Win) or cmd + enter
(Mac)alt + ctrl + p
(Win) or option + cmd + p
(Mac)shift + ctrl + s
(Win) or shift + cmd + s
(Mac)shift + ctrl + enter
(Win) or shift + cmd + enter
(Mac)Running Python code may need to update some packages. Please say YES!
When you run the Python code in the R console, the console will switch from R to Python.
Type quit
in the Python console to switch back to the R console.
The (global) environment is where we are currently working.
Anything created or imported into the current R/Python session is stored in the environment and shown in the Environment tab.
After we run the R script, objects stored in the environment are
mtcars
x
storing integer values 1 to 10.y
storing three numeric values 3, 5, 9.b
storing a string Hello World!
In the console pane, use ⬆️ to show the previous commands.
and more!
library()
.?
followed by the data name or function name likeWhat does the function mean()
do? What is the size of mpg
?
01-Running R Script
Create a R script named lab01-run-script.R in your 3570-project.
Copy and paste the code below into the script, and save it.