Every coding language will have the following elements.
- Data Types
- Variables
- Functions
- Strings
Every programming language consists of some kind of data. Datatype shows the specific data entered into a program. The data types are the keywords used to declare the type of the variable used in the program such as integer, real, character and string. The following is an example, where
splessons
is the data type.
[c]splessons<-'Start Thinking Start Coding'[/c]
The different memory locations where data resides are called objects. To access such an object it must have a name, and such a named object is called a
Variable
. The information stored inside an object is called as a value. Of course the machine itself typically has no idea how to interpret the information it contains, but the program certainly needs to know. For this reason a variable has a specific type. And it’s this type that constrains the use of that variable, such that only operations appropriate to the type may be performed. The following is an example, where x is the variable and the value of the variable is 10.
[c]x<-10[/c]
Functions
can be defined as a partitioned blocks of code in a program, which can be called any number of times during single execution of a program. Functions reduces the memory and complexity of the program. The following is the syntax for the functions in R programming langugae.
[c]function_name <- function(arg_1, arg_2, ...) {
Function body
}[/c]
Strings resemble sentences. Strings are shaped by a rundown of characters, which is truly a variety of characters. Strings are extremely valuable when conveying data from the program to the client of the program. They are less valuable while putting away data for the PC to utilize. The following is an example for the strings.
[c]a <- 'Welcome To SPlessons'
print(a)[/c]
Operators
are one of the pillar blocks in any programming language. Typically an Operator can work on one or more objects, also known as Operands, and it will return some of the results.