R Programming Exercises, Exercises of Programming Languages

A list of 20 R programming exercises covering topics such as input/output, data types, sequences, vectors, matrices, arrays, lists, and plotting. The exercises range from basic to intermediate level and require the user to write R programs to perform various tasks such as creating objects, calculating statistics, generating random numbers, reading files, and drawing plots. The document can be useful for students learning R programming or for practitioners who want to refresh their skills.

Typology: Exercises

2022/2023

Available from 02/28/2023

titiksha-patil
titiksha-patil 🇮🇳

2 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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.
2. Write a R program to get the details of the objects in memory.
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.
4. Write a R program to create a vector which contains 10 random integer values
between -50 and +50.
5. Write a R program to get the first 10 Fibonacci numbers.
6. Write a R program to get all prime numbers up to a given number (based on
the sieve of Eratosthenes).
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.
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.
9. Write a R program to find the factors of a given number.
10. Write a R program to find the maximum and the minimum value of a given
vector.
pf3

Partial preview of the text

Download R Programming Exercises and more Exercises Programming Languages in PDF only on Docsity!

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. 2. Write a R program to get the details of the objects in memory. 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. 4. Write a R program to create a vector which contains 10 random integer values between - 50 and +50. 5. Write a R program to get the first 10 Fibonacci numbers. 6. Write a R program to get all prime numbers up to a given number (based on the sieve of Eratosthenes). 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. 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 2 4 th^ letters in upper case. 9. Write a R program to find the factors of a given number. 10. Write a R program to find the maximum and the minimum value of a given vector.

11. Write a R program to get the unique elements of a given string and unique numbers of vector. 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. 13. Write a R program to create a list of random numbers in normal distribution and count occurrences of each value. 14. Write a R program to read the .csv file and display the content. 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. 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. 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. 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. 19. Write a R program to create a list of elements using vectors, matrices and a functions. Print the content of the list. 20. Write a R program to draw an empty plot and an empty plot specify the axes limits of the graphic.