0% found this document useful (0 votes)
5 views3 pages

Q2a R DataFrame Project

Ms. Meera, the project manager at XYZ Ltd., maintains project details in a data frame in R, which includes active projects with their IDs, names, budgets, and statuses. She adds two new projects to the existing data frame using the rbind() function, allowing for easy updates. The document highlights the use of data.frame() and rbind() functions for managing project information in R.

Uploaded by

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

Q2a R DataFrame Project

Ms. Meera, the project manager at XYZ Ltd., maintains project details in a data frame in R, which includes active projects with their IDs, names, budgets, and statuses. She adds two new projects to the existing data frame using the rbind() function, allowing for easy updates. The document highlights the use of data.frame() and rbind() functions for managing project information in R.

Uploaded by

lovinidone
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Q2 (a)

The project manager at XYZ Ltd., Ms. Meera, maintains the details of all active projects.
She has organized the information in the following table:

Project Id | Project Name | Budget | Status


1 | CRM Implementation | 120000 | In Progress
2 | Cloud Infrastructure | 180000 | Completed
3 | Network Upgrade | 60000 | Not Started
4 | E-Commerce Platform | 220000 | Completed
5 | Data Analytics | 90000 | In Progress

------------------------------------------------------------
i) Create a Data Frame in R for the above project data and display the output.

R Script:

# Create vectors for each column


ProjectId <- c(1, 2, 3, 4, 5)
ProjectName <- c("CRM Implementation", "Cloud Infrastructure",
"Network Upgrade", "E-Commerce Platform", "Data Analytics")
Budget <- c(120000, 180000, 60000, 220000, 90000)
Status <- c("In Progress", "Completed", "Not Started", "Completed", "In Progress")

# Create the data frame


project_df <- [Link](ProjectId, ProjectName, Budget, Status)

# Display the data frame


print(project_df)

Output (Exam-style):

ProjectId | ProjectName | Budget | Status


1 | CRM Implementation | 120000 | In Progress
2 | Cloud Infrastructure | 180000 | Completed
3 | Network Upgrade | 60000 | Not Started
4 | E-Commerce Platform | 220000 | Completed
5 | Data Analytics | 90000 | In Progress

------------------------------------------------------------
ii) Ms. Meera has approved 2 new projects. Add them to the existing data frame and display the
updated information.

Project Id | Project Name | Budget | Status


6 | UX Research | 160000 | Not Started
7 | Cloud Integration | 190000 | Not Started

R Script:

# New project data


new_projects <- [Link](
ProjectId = c(6, 7),
ProjectName = c("UX Research", "Cloud Integration"),
Budget = c(160000, 190000),
Status = c("Not Started", "Not Started")
)

# Combine both data frames using rbind()


updated_project_df <- rbind(project_df, new_projects)

# Display updated data


print(updated_project_df)

Output:

ProjectId | ProjectName | Budget | Status


1 | CRM Implementation | 120000 | In Progress
2 | Cloud Infrastructure | 180000 | Completed
3 | Network Upgrade | 60000 | Not Started
4 | E-Commerce Platform | 220000 | Completed
5 | Data Analytics | 90000 | In Progress
6 | UX Research | 160000 | Not Started
7 | Cloud Integration | 190000 | Not Started

------------------------------------------------------------
Conclusion:

- The [Link]() function is used to create tabular data in R.


- The rbind() function is used to add new rows (records) to an existing data frame.
- This allows Ms. Meera to easily update and maintain project details in R.

You might also like