In file 'R-Factor-Basics.docx', page 4, use the factor() command to modify the column dat$Group so that the control group is plotted last.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
3. In file 'R-Factor-Basics.docx', page 4, use the factor() command to modify the column
dat$Group so that the control group is plotted last.e
Transcribed Image Text:3. In file 'R-Factor-Basics.docx', page 4, use the factor() command to modify the column dat$Group so that the control group is plotted last.e
# Create the data frame.
emp.data <- data.frame (e
emp_id = c (1:5),
emp name = c("Rick","Dan","Michelle","Ryan","Gary"),-
salary = c(623.3,515.2,611.0,729.0,843.25),
start date =
as. Date (c ("2012-01-01", "2013-09-23", "2014-11-15",
"2014-05-11",e
"2015-03-27")),
stringsAsFactors = FALSE
# Add the "dept" coulmn.e
emp.data$dept <- c("IT","Operations","IT","HR","Finance")e
v <- emp.datae
print (v) e
When we execute the above code, it produces the following result
emp_id
emp_name
Rick
salary
start date
depte
1.
1
623.30
2012-01-01
IT-
2
Dan
515.20
2013-09-23
Operationse
3
3
Michelle
611.00
2014-11-15
IT-
4
4
Ryan
729.00
2014-05-11
HR
5
Gary
843.25
2015-03-27
Finance
Transcribed Image Text:# Create the data frame. emp.data <- data.frame (e emp_id = c (1:5), emp name = c("Rick","Dan","Michelle","Ryan","Gary"),- salary = c(623.3,515.2,611.0,729.0,843.25), start date = as. Date (c ("2012-01-01", "2013-09-23", "2014-11-15", "2014-05-11",e "2015-03-27")), stringsAsFactors = FALSE # Add the "dept" coulmn.e emp.data$dept <- c("IT","Operations","IT","HR","Finance")e v <- emp.datae print (v) e When we execute the above code, it produces the following result emp_id emp_name Rick salary start date depte 1. 1 623.30 2012-01-01 IT- 2 Dan 515.20 2013-09-23 Operationse 3 3 Michelle 611.00 2014-11-15 IT- 4 4 Ryan 729.00 2014-05-11 HR 5 Gary 843.25 2015-03-27 Finance
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education