# R Programming Basic: Exercises, Practice, Solution

## R Programming Basic [27 exercises with solution]

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

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.
Click me to see the sample solution

2. Write a R program to get the details of the objects in memory.
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.
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.
Click me to see the sample solution

5. Write a R program to get the first 10 Fibonacci numbers.
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).
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.
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.
Click me to see the sample solution

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

10. Write a R program to find the maximum and the minimum value of a given vector.
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.
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.
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.
Click me to see the sample solution

14. Write a R program to read the .csv file and display the content.
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.
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.
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.
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.
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.
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.
Click me to see the sample solution

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

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

23. Write a R program to compute sum, mean and product of a given vector elements.
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.
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.
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.
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.
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.

﻿