Skip to content

patmensa39/Variable-Assignment-in-R-programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Variable-Assignment-in-R-programming

In R, variable assignment is typically done using either the <- operator or the = operator. Here are examples of both: Using <- (recommended in R):

x <- 10 name <- "Patrick Mensah" numbers <- c(1, 2, 3, 4, 5)

Using = (an alternative way): x = 10 name = "Patrick Mensah" numbers = c(1, 2, 3, 4, 5)

Assigning a number to a variable

age <- 25

Assigning a string to a variable

name <- "Patrick Mensah"

Assigning a vector to a variable

scores <- c(88, 92, 79, 85)

In R, <- is more common and preferred because it makes assignments more explicit, distinguishing them from other operators.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published