1. Create a vector named x1 which contains a sequence starting at 1 and ending at 8, with each successive element being 1 larger than the other, i.e. (1, 2, 3, 4, 5, 6, 7, 8)

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
1. Create a vector named x1 which contains a sequence starting at 1 and ending at 8, with each
successive element being 1 larger than the other, i.e. (1, 2, 3, 4, 5, 6, 7, 8)
2. Before running the program, explain what will happen if you run the following code: \code{x1
+3} - Now run this program. What happened? What is this an example of?
3. Create an R function called \func{divideBy()}, which takes two arguments, \var{x} and
\var {y}. Let \var{x} be the quantity to divide, and let \var{y} be the quantity to divide
\var{x} by. Thus, if \var{x} = 3 and \var{y} = 2, the function should return 1.5
4. Can the function created in 3) take vector arguments? Answer this first before running the
program, and then experiment in R.
5. The following problem is MUCH easier if you've taken the time to install RStudio. Please use
RStudio! Let's make use of an example dataset - the \var{College} dataset from R package
\var{ISLR}. If you haven't used this package before, you'll have to install it with
\code{install.packages ("ISLR")}. This puts the source, including functions, datasets, and
other objects on your computer. You must then load/attach the package into your instance of R,
so that you can actually use the package. This is done by typing \code{library (ISLR)} in the
console. Now you're ready! The \var {College} variable holds the data frame for the College
dataset.
Type \code{?College} and hit enter in the console. This will bring up the help page for the
\var {College} dataset, that includes descriptions of the variables.
Transcribed Image Text:1. Create a vector named x1 which contains a sequence starting at 1 and ending at 8, with each successive element being 1 larger than the other, i.e. (1, 2, 3, 4, 5, 6, 7, 8) 2. Before running the program, explain what will happen if you run the following code: \code{x1 +3} - Now run this program. What happened? What is this an example of? 3. Create an R function called \func{divideBy()}, which takes two arguments, \var{x} and \var {y}. Let \var{x} be the quantity to divide, and let \var{y} be the quantity to divide \var{x} by. Thus, if \var{x} = 3 and \var{y} = 2, the function should return 1.5 4. Can the function created in 3) take vector arguments? Answer this first before running the program, and then experiment in R. 5. The following problem is MUCH easier if you've taken the time to install RStudio. Please use RStudio! Let's make use of an example dataset - the \var{College} dataset from R package \var{ISLR}. If you haven't used this package before, you'll have to install it with \code{install.packages ("ISLR")}. This puts the source, including functions, datasets, and other objects on your computer. You must then load/attach the package into your instance of R, so that you can actually use the package. This is done by typing \code{library (ISLR)} in the console. Now you're ready! The \var {College} variable holds the data frame for the College dataset. Type \code{?College} and hit enter in the console. This will bring up the help page for the \var {College} dataset, that includes descriptions of the variables.
Expert Solution
steps

Step by step

Solved in 6 steps with 2 images

Blurred answer
Knowledge Booster
Passing Array as Argument
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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