Assignment Operators
R provides several operators for assigning values to variables.
year = 2020
year <- 2020
2020 -> year
However, -> is rarely used because it reduces code readability.
Note
Going forward, assignments will be shown using the left arrow (<-) and the equal sign (=).
Opgave
Swipe to start coding
- Use the equal sign (
=) to assign the result of29 %/% 8to the variable namedequal. - Use the left arrow (
<-) to assign the result of29 %% 8to the variable namedleft. - Use the right arrow (
->) to assign the result ofequal ^ leftto the variable namedright. - Print the values of
equal,left, andrightin sequence using thecat()function.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 10
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Fantastisk!
Completion rate forbedret til 2.27
Assignment Operators
Stryg for at vise menuen
R provides several operators for assigning values to variables.
year = 2020
year <- 2020
2020 -> year
However, -> is rarely used because it reduces code readability.
Note
Going forward, assignments will be shown using the left arrow (<-) and the equal sign (=).
Opgave
Swipe to start coding
- Use the equal sign (
=) to assign the result of29 %/% 8to the variable namedequal. - Use the left arrow (
<-) to assign the result of29 %% 8to the variable namedleft. - Use the right arrow (
->) to assign the result ofequal ^ leftto the variable namedright. - Print the values of
equal,left, andrightin sequence using thecat()function.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 10
single