Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Option A: One important tool we haven't covered yet is a loop, such as a for-loop. In such a loop, R will iterate over the

image text in transcribedimage text in transcribed

Option A: One important tool we haven't covered yet is a loop, such as a for-loop. In such a loop, R will iterate over the values of an object using a counter. This is really helpful when you want to do something over and over again. Create a notebook with an R-cell in it where you can answer these questions. When answering, include your code and the output] (a) (2 points) Create a character vector called pr which stores the names of all the provinces in Canada. Then, create a second vector called pop which stores the population of each province in pr. You might want to look this up on Statistics Canada's website? (b) (2 points) In a for-loop, the syntax looks like: for (COUNTER in LIST) \{ do_stuff - to (COUNTER) do stor) The object COUNTER is a variable which the loop runs over, and LIST is a vector-like object that can be counted over. For example, try the code: What does it do? c) (2 points) Now, use a for-loop to print out the name of each province. 1) (4 points) In R, you can combine two pieces of text together with the with paste() command: n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

Students also viewed these Databases questions

Question

2. What is the impact of information systems on organizations?

Answered: 1 week ago

Question

Evaluate the impact of technology on HR employee services.

Answered: 1 week ago