R Programming Tutorial – 1, Learn to Write First Program in R

In the previous post, I have discussed about the installation of R and R Studio in Windows. Now is the time to start learning real R Programming. Before going to write our first program in R, we need to study basic features of R Programming language.

  • The core of R is an interpreted computer language
  • R allows integration with the procedures written in the C, C++, .Net, Python or FORTRAN languages for efficiency
  • R is freely available under the GNU General Public License
  • R provides graphical facilities for data analysis
  • R has an effective data handling and storage facility

R Programming Tutorial-1

Writing first program in R Programming

As usual we will start by writing “Hello World” in R. Open R Studio and go to console window as shown below:

R Programming Tutorial-How to Write first program in R-1

To print “Hello World” just type “Hello World” on the console and hit enter, you will that the output appears.

R Programming Tutorial-How to Write first program in R-2

This is how you can print “Hello World” in R, isn’t it simple. Now to assign any value in R to a variable use <- sign. For example to assign the value of 4+5 to x just type x<-4+5. To see the value of variable, just type the name of variable and press enter. See below image where I am printing the value of x.

R Programming Tutorial-How to Write first program in R-3

Thank you for reading the post. Subscribe Technokarak.com for more Programming Tutorials.

Leave a Reply