MATH 734

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

1/11

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:18 PM on 9/8/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

12 Terms

1
New cards

What does Is() do?

Shows what has been defined in the environment

2
New cards

What is the output of the following code —> sum(c(TRUE,TRUE,FALSE,TRUE))

3 because a logic value is 1 for TRUE and 0 for FALSE

3
New cards

What is the output of the code c(1,10,100) * 1.5?

1.5 15.0 150.0

4
New cards

Given x ← c(a = 10, b = 20, c = 30)
x1 ← x[c(2,3)]
Are x[2] and x1[2] the same? And are x[‘b’] and x1[‘b’] the same? Briefly explain why or why not

  1. x[2] and x1[2] are not the same because x[2] refers to b 20 and x1[2] refers to c 30, since the second position of x1 is the third position of x

  2. x[‘b’] and x1[‘b’] are the same because they refer to names over position and since both x and x1 have ‘b’, they both output b = 20


5
New cards

What is the difference between identical() and all.equal()

  1. Identical() asks if these two objects are the exact same, down to how they look

    1. If you had 0.5-0.3 and 0.3-0.1, it would produce FALSE because they are not the same despite both equaling 0.2

  2. all.equal() asks if these values are equal, so in the previous example, it would be TRUE because both statements equate to 0.2


6
New cards

TRUE or FALSE
Run the code xx <- c(a=1, b=2)

Object xx does not have an attribute "names", because it does not use function attr() to add this attribute

FALSE because the names a and b auto make a names attribute for xx even if you didn’t use attr()

7
New cards

What does “rep” do?

rep Replicates the elements in a vector, it works like this

rep( value/s, x amount of times)

So rep(1,5) = 1 1 1 1 1 and

rep(c(1,2,3),4) = 1 2 3 1 2 3 1 2 3 1 2 3

8
New cards

What happens if you rep(c(1,2,3), c(2,1,4)

1 1 2 3 3 3 3
The number in each vector comes out as the amount on the other vector, so since it’s 2 in the first vector, it’s going to be 2 1s

9
New cards

What does “seq” do

seq makes a sequence of equally spaced numbers on a linear scale

so seq(1,15,2) works like (start, end, slope). This comes out as

1 3 5 7 9 11 13 15

10
New cards

How to use if and else together

Start with the if

if (x > 0.5) {

Then use a curly bracket to group the expression

cat(“head\n)

y ← 1

Then use else

} Else {

cat(“tail\n”)

y ← 0

}

11
New cards

Logical Conditions

FALSE || TRUE = TRUE

NA || TRUE = TRUE

FALSE | TRUE = TRUE


FALSE && TRUE = FALSE

NA && TRUE = NA


T || F || F = TRUE

12
New cards