LSUS BADM790 Quiz 2

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

How do you select a variable from a data frame?

$ "extraction operator", which is used to view a single variable/column in a data frame airlines$name (airline = vector and name = variable) We used the $ operator to extract only the name variable and return it as a vector of length 16.

Differentiate between the different types of logical operators (&, |, !)

& = AND I = OR ! = NOT Double ( !!, II, and &&) return result for only first value.

How do you install a package?

Click on the "Packages" tab. Click on "Install" next to Update. Type the name of the package under "Packages (separate multiple with space or comma):" In this case, type ggplot2. Click "Install." install.packages("packagename") An alternative but slightly less convenient way to install a package is by typing install.packages("ggplot2") in the console pane of RStudio and pressing Return/Enter on your keyboard.

Know the different ways you can ask R for help documentation with a dataset or function.

Example: help(sd) ?sd

Load Data versus Load Packages

Load Data -- read.type() Load Package -- library()

Know when to use the str() command and the summary() command.

Str() Str is a compact way to display the structure of an R object. This allows you to use str as a diagnostic function and an alternative to summary. Str will output the information on one line for each basic structure. Str is best for displaying contents of lists - even with nested lists. Can use Str() to get a summary of another function! Gives name of object, things like number of variables, number of objects in a dataframe, etc. Summary() - For a Dataframe - Summary of each individual column - For a vector it gives values: min, 1st Quartile, Median, Mean, 3rd Quartile, Max

What does (na.rm = TRUE) mean?

That the function should remove missing values before executing commands / calculations

Know how to load datasets that come with R.

Through the R-Studio menus -- 1) Environment --> Import Data Set 2) Tools --> Import Data Set From the console: read.table("x") read.csv() read.delim() (and lots of other types listed in R console help notes

How do you load a package?

We do this by using the library() command. For example, to load the ggplot2 package, run the following code in the console pane: library(ggplot2) Can ALSO go to the list of packages and click next to the name - the video called this "attaching" / "docking" the package.

Know how to identify a default argument within a function.

args(function)


Kaugnay na mga set ng pag-aaral

7.3.1-7.4.7 Transcription and Translation

View Set

unit 7 practice qs french rev/ nap/ congress of vienna

View Set

Chapter 5: Prostate Cancer (Health Issues)

View Set

Language features and their effects

View Set

Nutrition Chapter 7 Water and Electrolytes Cengage

View Set

Unit 4 (from packet) The American Revolution

View Set