1/31
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
a collection of lines of code is called…
a script
why code? (3)
Handles large complex datasets better than many commercial software products (like Excel
Expands the suite of tools you can use to analyse and visualize data
Coders / programmers are in demand in the job market. Even if your career isn’t focused entirely on coding, there are many jobs which advertise coding experience as an asset
or requirement.
why R? (4)
R is free and open source!
R provides a wide variety of statistical and graphical techniques.
R works on data of all shapes and sizes.
R produces high-quality graphics
R code (and coding in general) is great for reproducibility
what is the console called?
RGUI
Source Pane
Displays script. Type your code here. Click on Run to execute. Results appear below
Console Pane
Script output is shown here. You can also type code directly (press Return to execute)
Environment/History Pane
Script output is shown here. You can also type code directly (press Return to execute)
Files/Help/Plot Pane
exactly what it says. switch between tabsto access files, help, and plot visualizations.
Variables
used to store data
variablename < -
must start with a letter or period
cannot be a reserved word (e.g. TRUE, FALSE, NA)
Operators
arry out different mathematical and logical operations.
+ – * / < > == !=
Functions
execute a specific task. Functions can be built-in, or users can make functions.
mean() median() sd() var()
can take multiple arguments within the brakets
Mathematical Operators
+
-
*
/
^ or **
Logical Operators
> greater than
>= greater or equal to
== equal to
!= not equal to
how to make a comment
“#” followed by intended comment
R data types
numeric
integer
double
character
logical
numeric data
numbers
integer data
numbers that do not contain decimal values
double data
numbers that contain decimal values
character data
string of keyboard characters (within quotations)
“hello2you” “3.4”
logical data
truth values
TRUE or FALSE
how to check the type of data?
use the function: typeof()
reserved words
TRUE = logical value
FALSE = logical value
NA = Not Available, represents a missing value
NaN = Not a number, 0/0
Inf = infinity, 1/0
where are variable stored?
environment
Unlike spreadsheet programs such as Excel, R does not prioritize showing you…
the entire dataset
R data steuctures
vector
matrix
list
dataframe
vector
Set of elements with the same data type
matrix
2D array of elements with the same data type
list
Set of elements with different data types
dataframe
2D array of elements with different data types
how are excel spreadsheets imported into R?
as dataframes
how to open the Help pane which provides more
information on the function and its arguments?
?functionaname
e.g. breakdown: typeof(x)
typeof = function
x = the only argument of the function and is any R object.
the function returns the data type of x