0% found this document useful (0 votes)
19 views4 pages

Format of R File

Uploaded by

nain09364
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views4 pages

Format of R File

Uploaded by

nain09364
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Project 1.

Installation and Setup


A. Install and set up R and RStudio
B. Familiarize yourself with the interface and various windows

Project 2. Create Objects in R


A. Create a vector of integers from 1 to 20.
Program:
Output:
B. Create a vector of factor type for different weather conditions (Sunny, Rainy, Cloudy,
Snowy).
Program:
Output:
C. Create a list of vectors with the names of 5 countries and their respective populations.
Program:
Output:

D. Create a data frame with 5 employees, their age, department, and monthly salary.
Program:
Output:

Project 3. Apply str() and summary() commands to the object


A. str():
a) The str() function gives a compact, structural summary of an object.
b) It shows the data type, structure, and a quick overview of the components of the object, such
as the variable names and their data types.

Program:
Output:

B. summary():
a) The summary() function provides a statistical summary of an object.
b) For numeric data, it includes minimum, maximum, mean, median, and quartiles.
c) For factors, it shows the count of each level.
d) For other data types, it provides relevant summaries

Program:
Output:

Project 4. String Manipulation


A. Load the stringr library and analyze the string: "apple, banana, cherry, date". Find and
replace "banana" with "blueberry".

Program:
Output:
Project 5. Vector Operations
A. Create a vector of numbers from 1 to 200, divisible by 4. Perform:
a) Calculate the length.
b) Extract the 10th, 25th, and 50th elements.
c) Replace values at index 15 with NA and find the mean of the modified vector.

Program:
Output:

Project 6. Matrix Operations


A. Create a 3x3 matrix with random integers:
a) Replace elements at positions (2, 2) with NA.
b) Compute the column-wise mean.

Program:
Output:

Project 7. String Operations


A. Analyze a vector of city names: c("New York", "London", "Tokyo", "Paris",
"Berlin").
a) Count characters in each name.
b) Find cities containing the letter "o".

Program:
Output:

Project 8. Factor Data


A. Create a factor vector for vehicle types (Car, Bike, Bus, Train):
a) Display factor levels.
b) Modify levels to include "Truck".

Program:
Output:

Project 9. Employee Data Management


A. Create a data frame of 10 employees with names, age, and monthly salaries. Find the
employee with the highest salary.

Program:
Output:
Project 10. Histogram Plotting
A. Generate a histogram for the distribution of ages in a dataset of 100 people.

Program:
Output:

Project 11. Scatter Plot with Regression


A. Create a scatter plot for height vs. weight data and add a regression line.

Program:
Output:

Project 12. Data Frame Handling


A. Create a data frame of sales data (5 products, sales, profit). Find the most profitable
product.

Program:
Output:

Project 13. Matrix Operations with Custom Data


A. Perform transpose and inversion operations on a 4x4 matrix.

Program:
Output:

Project 14. Advanced Visualization


A. Plot the pressure dataset with different forms (line chart, bar chart).

Program:
Output:
Project 15. Generating a Matrix with Row-Major Order of Numbers in R
A. Create a matrix m of five rows in a row -major order of numbers from 1 to 100
incremented by a step of 5 units.
a) Find row and columns -wise means of matrix m.
b) Find the minimum value for each row and column.
c) Find the transpose and sort the values in each columns in decreasing order.
d) Assign the row names as R1to R5 and column names C1 to C4.
e) Display all the elements of the second and fourth column without using indices.
f) Display all the elements of the first and third row without using indices.
g) Create a new matrix by deleting the second and fourth column of matrix m using indices and
column names.
h) Replace elements at indices (2,3), (2,4), (3,3), and (3,4) with NA values.
i) Replace elements at index (1,3) with NaN.
j) Check if matrix m contains any NA or NaN values and interpret the output.
k) Create two new matrices rm and cm by concatenating matrix m row-wise and column-wise
with itself

Program:
Output:

Project 16. Matrix Multiplication with Randomly Generated Matrices in R


A. Create a 4*3 matrix A of uniformly distributed random integer numbers between 1 to
100. Create another 3*4 matrix B with uniformly distributed random integer numbers
between 1 to 10. Perform matrix multiplication of the two matrices and store the result
in a third matrix C.

Program:
Output:

You might also like