Chapter 2 Flashcards
What is R?
R is a free statistical computing software widely used in fields like psychology, bioinformatics, and machine learning.
What is the recommended editor for writing R commands?
R Studio is the recommended editor for writing and modifying R commands.
What are the basic arithmetic operations in R?
Basic arithmetic operations include addition (+), subtraction (-), multiplication (*), and division (/).
What logical operators are used in R?
Logical operators include <, <=, ==, !=, >=, >, which return boolean values (TRUE or FALSE).
What are some common mathematical functions in R?
Common mathematical functions include sqrt(), log10(), sin(), abs(), round(), and mean().
How do you assign values to variables in R?
Values are assigned to variables using the <- operator.
What are the rules for naming variables in R?
Variable names must be case-sensitive, avoid minus signs, and not overlap with function names.
How are strings represented in R?
Strings are represented as character sequences enclosed in double quotes, e.g., “Text”.
How do you create vectors in R?
Vectors can be created using c() for concatenation or numeric(n) for a vector of zeros.
What functions can be used on vectors in R?
Functions like mean(), var(), and sum() can be applied to vectors. Sequences can be generated with : or seq().
How do you create matrices in R?
Matrices can be created by combining vectors with cbind() or by importing data using read.csv().
How do you access elements in a matrix in R?
Elements in a matrix can be accessed using d[row, column] or $column_name for specific columns.
How can new columns be added to matrices or data frames in R?
New columns can be added by assigning values to a new column name, e.g., d$new_col <- values.
How do you extend R’s functionality?
R’s functionality can be extended by installing and loading packages using library(package).
Where can you find resources and tutorials for learning R?
Resources include the official R manual at CRAN and tutorials at StatMethods.net.