In R, you can assign a value to a variable using the assignment operator <- or =. The general syntax is:
main.r52 chars6 lines
Here's an example:
main.r41 chars7 lines
Output:
main.r13 chars3 lines
In this example, we assigned the value 10 to the variable x using the <- operator, and the value 5 to y using the = operator. We then printed the values of x and y using their respective variable names.
gistlibby LogSnag