Into to applied data science tutorial 1

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:23 PM on 5/13/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

15 Terms

1
New cards

character_vec[2:3]

Gets the second and third elements of character_vec

2
New cards

logical_vec[-1]

Gets all the elements of logical_vec except the first

3
New cards

logical_vec[-c(1,2)]

All elements of logical_vec EXCEPT the first and second

4
New cards

students <- data.frame

Creating data frames named students

5
New cards

students$name

Acessing colum name in students data frame

6
New cards

students[["gpa"]]

Acessing colum gpa in students data frame

7
New cards

students[, "has_job"]

Acessing colm has_job in students data frame

8
New cards

getwd()

Check current working directory

9
New cards

list.files(".")

# List files in current directory

10
New cards

library(here)

Using the here package for robust path handling (always starts from project root)

11
New cards

How do you create a numeric vector called inflation_rates containing these values: 2.1, 3.4, 1.8, 4.2, 2.9. What is the result of inflation_rates[3]?

inflation_rates ← c(2.1, 3.4, 1.8, 4.2, 2.9). Result 1.8

12
New cards

Create a character vector called countries with elements: “Netherlands”, “Germany”, “France”, “Italy”. Use negative indexing to return all countries except “Germany” (the second element). Then get the same result using positive indexing.

countries <- c("Netherlands","Germany","France","Italy"). countries[-2]. countries[c(1,3,4)]

13
New cards

Given the vector x ← c(10, 20, 30, 40, 50), what does x[c(2,4)] return? What does x[x > 25] return?

20 40 and 30, 40, 50

14
New cards

Create a data frame called cities with three columns:

  • name: “Amsterdam”, “Rotterdam”, “The Hague”

  • population: 872680, 651406, 545838

  • province: “Noord-Holland”, “Zuid-Holland”, “Zuid-Holland”

cities <- data.frame(

name = c("Amsterdam", "Rotterdam", "The Hague"),

population = c(872680, 651406, 545838),

province = c("Noord-Holland", "Zuid-Holland", "Zuid-Holland")

)

15
New cards

cities <- data.frame(

name = c("Amsterdam", "Rotterdam", "The Hague"),

population = c(872680, 651406, 545838),

province = c("Noord-Holland", "Zuid-Holland", "Zuid-Holland")

)

How would u asses the population of rotterdam in three different ways?

cities$population[1]

cities[["population"]][1]

cities[,"population"][1]