Variables in R Programming

Definition:

Temporary Storage Space where you can keep changing values

 Rules:

Letters, number, underline & Dots combination allowed. The variable name starts with a letter or the dot not followed by a number.

Example:

x1.-> Valid

x_2%-> Invalid, it has % symbol

2_x-> Invalid, Starts with number

.x_1-->Valid, Can start with a dot(.) but the dot(.)should not be followed by a number

.2x--> Invalid, after dot number should not come

_x_1--> Starts with _ which is not valid

Output in R Console:

x1.<-1 

x_2%<-2
Error: unexpected input in "x_2%<-2"

2_x<-3
Error: unexpected input in "2_"

.x_1<-4

.2x<-5
Error: unexpected symbol in ".2x"

_x_1<-6
Error: unexpected input in "_"


Comments

Post a Comment

Popular posts from this blog

Vector Data Type in R Programming

Arrays in R Programming