1. Create numeric vector that runs from 1 to 10 and let R print it. To create and print it right away, you need to enclose your statement with .
(my_numeric_vector <-seq(1, 10))
#  [1]  1  2  3  4  5  6  7  8  9 10
  1. Now transform that vector so that it's 8th element is being multiplied by 4. To access single elements of a vector, you need to use its index via .
my_numeric_vector[8] <- my_numeric_vector[8] * 4

my_numeric_vector
#  [1]  1  2  3  4  5  6  7 32  9 10
  1. Now transform that vector. Please add 7 to it's second element.
my_numeric_vector[2] <- my_numeric_vector[2] + 7

my_numeric_vector
#  [1]  1  9  3  4  5  6  7 32  9 10
  1. Now transform that vector so that its 1st element is being multiplied by 5 and add 8 to its 3rd element.
my_numeric_vector[c(1, 3)] <- c(my_numeric_vector[1] * 5, 
                                my_numeric_vector[3] + 8)

my_numeric_vector
#  [1]  5  9 11  4  5  6  7 32  9 10
  1. Please create a vector named conti. And copy the following code to create conti.
conti <- factor(
  x = c("Europe", "Africa", "Africa", "Asia", "South America"),
  levels = c("Africa", "Asia", "Australia",
             "Europe", "North America", "South America")
)

Recode the continent variable into Danish. To do that, we use the function from the forcats package.

# Recode conti to Danish.
# Watch out: first the new, then the old value...
conti <- fct_recode(conti, 
                    "Europa" = "Europe", 
                    "Afrika" = "Africa", 
                    "Asie" = "Asia", 
                    "Nordamerika"="North America",
                    "Sydamerika" = "South America") 

table(conti)
# conti
#      Afrika        Asie   Australia      Europa Nordamerika  Sydamerika 
#           2           1           0           1           0           1
  1. Add Atlantis as another level. Now we need the function. If you don't know, you can google for help.
conti <- fct_expand(conti, "Atlantis")

table(conti)
# conti
#      Afrika        Asie   Australia      Europa Nordamerika  Sydamerika    Atlantis 
#           2           1           0           1           0           1           0
  1. Reorder the factor vector such, that Atlantis is shown first. Now we need the function.
conti <- fct_relevel(conti, "Atlantis")

table(conti)
# conti
#    Atlantis      Afrika        Asie   Australia      Europa Nordamerika  Sydamerika 
#           0           2           1           0           1           0           1