R Variables

Variables are reserved memory locations. In Python, you only need to assign a value for variable declaration. This works the same for the R programming language. Let’s see.

Create a Variable in R

An R variable gets created when a value is assigned. That is it! The following sign is used to assign a value to a variable:

<-

Let us create a variable in R and print a number:

marks <- 96

# Output
Marks

Multiple Variables

Let us now see how to display multiple variables in the R programming language:

# string
name <- "Amit Diwan"

# number
rank <- 1

# number
marks <- 96

# float
points <- 125.40

# display
name
rank
marks
points

Output

[1] "Amit Diwan"
[1] 1
[1] 96
[1] 125.4

If you liked the tutorial, spread the word and share the link and our website Studyopedia with others.


For Videos, Join Our YouTube Channel: Join Now


Read More:

R Comments
R Data types
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment