Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 23.4 11 pi > for (i in 1:length(primey) 3.3 What is returned by the following R commands? > sumsq = 0 > primes =

Question 23.4

image text in transcribed

11 pi > for (i in 1:length(primey) 3.3 What is returned by the following R commands? > sumsq = 0 > primes = c(2, 3, 5, 7, 11) > for (i in 1:3) sums = sumsq + primes[i] * 2 > sums feel the need for speed 23.4 The following R code contains a for loop and executes slowly. You feel the need for Give a single line of R code that vectorizes this computation and executes quickly! > n = 1000000 > X = numeric(n) > for (i in 1:n) x[i] = rpois (1, 3) + rpois (1, 5)

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

More Books

Students also viewed these Databases questions