R New
R New
R PROGRAMMING LANGUAGE
It features extensive packages for various statistical techniques and offers strong data
visualization capabilities through tools like ggplot2. As an open-source language, R is
accessible on multiple platforms and supports integration with other programming languages.
o https://cran.r-project.org/bin/windows/base/
Click on the R 3.2.2.exe file. The 3.2.2 is the version number of the file. The versions
can be updated as per the latest releases.
1
R language
The Set Up will request permission to be installed on the system click yes to proceed.
2
R language
Select the Preferred language from the dropdown to begin an installation in that
preferred language.
3
R language
4
R language
Choose the path where you wish to install R by clicking on browse and changing the
workspace locations. Click next to proceed with the default installation. The minimum
space requirements are mentioned at the bottom of the dialog box. Please check you
have required amount of free space in your drive.
Choose the type of installation you require. By defaults R installs both the 32 and 64
bits versions on your system. If your system is a 32 bits system you will be requiring a
32 bits installation if the system is a 64 bits system it will be requiring 64 bit
installation. Do not uncheck the Core Files and Message Translations. Please make note
of the space requirement of the installation.
5
R language
To customize the startup options for R choose option and customize. To proceed with a
vanilla installation use Next.
6
R language
To generate program shortcuts and naming those as per your requirement specify the
necessary customizations. To proceed with the default installation hit next.
7
R language
After the installation has completed you will see the final screen. Click finish to
complete the installation.
8
R language
Open Start Menu and you will find R in the available set of Programs.
10
R language
print(sum_result)
print(diff_result)
print(prod_result)
print(div_result)
Output:
csharp
Copy
[1] 15
[1] 5
[1] 50
[1] 2
Code:
R
Copy
for (i in 1:5) {
print(i)
}
Output:
[1] 1
[1] 2
[1] 3
[1] 4
[1] 5
[1] 2 4 6 8 10
Output:
csharp
Copy
[1] 3
6. Simple Function to Add Two Numbers
Code:
add_numbers <- function(a, b)
{
return(a + b)
}
result <- add_numbers(5, 3)
print(result)
Output:
[1] 8
7. Create a Matrix
Code:
my_matrix <- matrix(1:6, nrow = 2, ncol = 3)
print(my_matrix)
Output:
13
R language
here are the simple R programs with outputs that will help you understand basic R
programming concepts like vectors, loops, functions, matrices, and data frames. Let me
know if you'd like more examples or explanations!
14
R language
15
R language
16