# R Programming Basic: Exercises, Practice, Solution

[An editor is available at the bottom of the page to write and execute the scripts.]

## R Programming Basic [27 exercises with solution]

1. Write a R program to take input from the user (name and age) and display the values. Also print the version of R installation. Go to the editor
Click me to see the sample solution

2. Write a R program to get the details of the objects in memory. Go to the editor
Click me to see the sample solution

3. Write a R program to create a sequence of numbers from 20 to 50 and find the mean of numbers from 20 to 60 and sum of numbers from 51 to 91. Go to the editor
Click me to see the sample solution

4. Write a R program to create a vector which contains 10 random integer values between -50 and +50. Go to the editor
Click me to see the sample solution

5. Write a R program to get the first 10 Fibonacci numbers. Go to the editor
Click me to see the sample solution

6. Write a R program to get all prime numbers up to a given number (based on the sieve of Eratosthenes). Go to the editor
Click me to see the sample solution

7. Write a R program to print the numbers from 1 to 100 and print "Fizz" for multiples of 3, print "Buzz" for multiples of 5, and print "FizzBuzz" for multiples of both. Go to the editor
Click me to see the sample solution

8. Write a R program to extract first 10 english letter in lower case and last 10 letters in upper case and extract letters between 22nd to 24th letters in upper case. Go to the editor
Click me to see the sample solution

9. Write a R program to find the factors of a given number. Go to the editor
Click me to see the sample solution

10. Write a R program to find the maximum and the minimum value of a given vector. Go to the editor
Click me to see the sample solution

11. Write a R program to get the unique elements of a given string and unique numbers of vector. Go to the editor
Click me to see the sample solution

12. Write a R program to create three vectors a,b,c with 3 integers. Combine the three vectors to become a 3×3 matrix where each column represents a vector. Print the content of the matrix. Go to the editor
Click me to see the sample solution

13. Write a R program to create a list of random numbers in normal distribution and count occurrences of each value. Go to the editor
Click me to see the sample solution

14. Write a R program to read the .csv file and display the content. Go to the editor
Click me to see the sample solution

15. Write a R program to create three vectors numeric data, character data and logical data. Display the content of the vectors and their type. Go to the editor
Click me to see the sample solution

16. Write a R program to create a 5 x 4 matrix , 3 x 3 matrix with labels and fill the matrix by rows and 2 × 2 matrix with labels and fill the matrix by columns. Go to the editor
Click me to see the sample solution

17. Write a R program to create an array, passing in a vector of values and a vector of dimensions. Also provide names for each dimension. Go to the editor
Click me to see the sample solution

18. Write a R program to create an array with three columns, three rows, and two "tables", taking two  vectors as input to the array.  Print the array. Go to the editor
Click me to see the sample solution

19. Write a R program to create a list of elements using vectors, matrices and a functions. Print the content of the list. Go to the editor
Click me to see the sample solution

20. Write a R program to draw an empty plot and an empty plot specify the axes limits of the graphic. Go to the editor
Click me to see the sample solution

21. Write a R program to create a simple bar plot of five subjects marks. Go to the editor
Click me to see the sample solution

22. Write a R program to create  bell curve of a random normal distribution. Go to the editor
Click me to see the sample solution

23. Write a R program to compute sum, mean and product of a given vector elements. Go to the editor
Click me to see the sample solution

24. Write a R program to create a list of heterogeneous data, which include character, numeric and logical vectors. Print the lists.Go to the editor
Click me to see the sample solution

25. Write a R program to create a Dataframes which contain details of 5 employees and display the details.Go to the editor
Click me to see the sample solution

26. Write a R program to create a Data Frames which contain details of 5 employees and display summary of the data.Go to the editor
Click me to see the sample solution

27. Write a R program to create the system's idea of the current date with and without time.Go to the editor
Click me to see the sample solution

R Programming Code Editor:

More to Come !

Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.

﻿