Here,You can Learn Basic R Programming Examples with Output for Freshers
Once you have R environment setup, then it’s easy to start your R command prompt by just typing the following command at your command prompt-
This will launch R interpreter and you will get a prompt-Where you can start typing your first program as follows:
Basic “Hello World” program:
>firString <- “Hello World!”
#we can use the print () function
> print (firstString)
And next save the above code in file test.R and execute it at Linux command prompt as given below.evn if you are using windows or other different system, syntax will remain same. (The R Script is executed using Source command)
$ Rscript test.R
When we run the above program, it produces the following output.
 “Hello World!”
Here first statement defines a string variable firstString, where we assign a string “Hello World!” and then next statement print () is being used to print the value stored in variable firstString.
Above Program (First example)
#Quotes can be suppresses in the output
> print (“Hello World!”, quote-FALSE)
 Hello World!
The quotes are printed by default. To avoid this, we can pass the argument quote=FALSE
Above Program (Second example)
#If you have to print more than one value then use the function paste () or get ().
>print (paste (“Welcome”,”to”,”my”,“first”,”program”))
 “Welcome to my first program”
If there are more than one item, we can use the paste () and cat () function to concatenate the string together.
Here, Some R Programming Examples: