Study material generic cover image

Summary Basic Skills In Mathematics

Course
- Basic skills in mathematics
219 Flashcards & Notes
Scroll down to see the PDF preview!
  • This + 400k other summaries
  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo

A snapshot of the summary - Basic skills in mathematics

  • 1 lecture 1

    This is a preview. There are 10 more flashcards available for chapter 1
    Show more cards here

  • Explain what different object modes are?
    • There are different types of objects in R: - numeric, e.g., 2, 0.03 - character, e.g., ‘a’, “b” - logical, TRUE, FALSE 
    • These are called modes 
    • To request the mode of object x use mode(x) 
    • a mode is the category an object belongs to.
  • What are characters and strings?
    • Anything between single or double quotation marks is stored as a character, which can be used to encode strings: 
      • strings are kind of naming objects a different name.
    • a character is the object, and the string is the second name that is given to that character, what it's also reffered by.
    • characterObject <- 'this is a string' 
    • characterObject2 <- "this is also a string" 
    You can not do mathematical expressions with character strings, even when the string looks like a number
  • Describe the logical mode.
    • The logical mode indicates a Boolean object which can only be true (TRUE) or false (FALSE): 
    • logicalObject <- TRUE 
    • these logical objects can be used in compariosn tests;
      • 1 == 1 # Is 1 equal to 1?
      • ## [1] TRUE
  • How can you test and transform modes?
    • You can use functions named is.mode to test the mode of an object: 
      • a <- 1.23 is.logical(a) 
      • ## [1] FALSE 
    • You can use functions named as.mode to transform objects into a different mode: 
      • "1" + 1 ## Error in "1" + 1: non-numeric argument to binary operator 
      • as.numeric("1") + 1 
      • ## [1] 2 
  • What does the rep function do?
    • A vector containing copies of the same object can be created using rep(object,number_of_repetitions): 
    • For example, rep(1,3) creates the vector [1 1 1]
      • Create a vector with n copies:
      • v <- c('a','b','d')
      • v
      • ## [1] "a" "b" "d"
      • rep(v,3)
      • ## [1] "a" "b" "d" "a" "b" "d" "a" "b" "d"
  • What does the sample function do?
    You can create a vector of n random samples from another vector using sample(vector_to_sample_from, n)
    • v1 <- seq(1, 4, 0.5) 
    • v2 <- sample(v1, 4) 
    • v2 
    • ## [1] 2.0 3.5 4.0 1.5  
  • How can you perform mathematical computations with vectors?
    • You can perform elementwise operations on vectors:
    • a <- c(10,20,30)
    • b <- 1:3
    • a + b # Add each element in a with the same element in b
    • ## [1] 11 22 33
    • a * b # Multiply each element in a with the same element in b
    • ## [1] 10 40 90
  • How can you apply logical implications to vectors?
    • You can apply logical operations to vectors:
    • a <- c(10,20,30)
    • b <- c(5,20,50)
    • a < 20 # Test each element of a if it is smaller than 20
    • ## [1] TRUE FALSE FALSE
  • What is indexing and how do you do it?
    • You can select a subset of vector element using indexing
    • Using square brackets [ and ], you can indicate which elements to return as:
    • A vector containing numbers of the elements you wish to keep
      • a[5] # Get the fifth element of vector a
      • a[c(1,5)] # Get the first and fifth element of vector a
    • A minus sign followed by the element you wish to omit
      • a[-5] # Get everything except the fifth element of vector a
    • A vector containing a TRUE or FALSE for each element, TRUE indicating you want to keep the element
      • a < 5 
      • ## [1] TRUE TRUE FALSE FALSE FALSE 
  • How do you index the values of a variable?
    Type datafilename$variable

To read further, please click:

Read the full summary
This summary +380.000 other summaries A unique study tool A rehearsal system for this summary Studycoaching with videos
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart