Quiz 7 Flashcards
What is R?
- programming language for statistical computing and data analysis
- provides a wide range of statistical and graphical techniques and is highly extensible through packages
What is RStudio?
- integrated development environment (IDE) for R
- provides user-friendly interface for writing and running R code
- includes a script editor, console, workspace, and many useful tools for data analysis
What is tidyverse?
- collection of R packages designed for data science and data analysis
What is a vector?
- Fundamental data structure used to store a collection of values of the same data type
- can be various types
What are the various types of vectors?
- numeric (ex numbers or decimals)
- character (ex text)
- logical (TRUE or FALSE)
What function is used to create a vector in R?
c () function (concatenate)
Ex. Colors
What function is used to create a vector in R?
c () function (concatenate)
Ex. Colors
What does R provide?
- wide range of statistical and graphical techniques
- is highly extensible through packages
What does tidyverse do?
Follows a consistent and intuitive syntax, making data manipulation and visualization easier
What are the components of the RStudio interface?
- console window
- scripting window
- environment
- plots
How can you save and reuse scripts for the future in R?
- by writing in the scripting window
What are 2 ways to run a code in R?
- type code in console window, press Enter
- type in scripting window and press CTRL (CMD) + Enter
What would you type to assign variable x the number 3?
Either:
x <- 3
Or
x=3
How can you check the value of a variable (ex. x)?
Print(x) or just x
In R, what is the shortcut for <-?
ALT + - (hyphen)
How would you assign the name “John” to the variable ‘first’? How can you confirm it worked?
first <- “John”
print (first)
How would you concatenate string variables in R? (ex. put “first” and “last” names together)
Give string a name and identify the component variables
ex. full_name= paste0 (first, last)
What are the basic data types in R? Examples?
- numeric (a <-23)
- character (b <- “speech_data”)
- logical (c <- TRUE)
- complex (d <-2+3i)
What can you type in R to check the data type of a variable?
class (x)
How can you identify a function in R?
It’s anything that starts with a name/word followed by parentheses
Ex. Class(x)
How would you create a numeric vector in R?
numeric_vector <- c (1,2,3,4,5)
(‘c’ is for concatenate)
How would you create a character vector in R?
character_vector <- c (“apple”, “banana”, “cherry”)
How would you create a logical vector in R?
Logical_vector <- c (TRUE, FALSE)