Question

1. Write a for loop that prints the first four numbers of the vector: x <c(7, 4, 3, 8, 9, 25) HINT: this is a very simple for loop but to print the chosen values you will need to use [ ] notation

use Rstudio

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1 2 x-c(7,4,3,8,9,25) 3 xnew-cO 4 fori in 1:4) 6xnew[i]-x[i] 7 8 print(xnew) 8:12 (Top Level) Console I >X-c(7,4,3,8,9,25) >xnew-c() for (i in 1:4) xne[i]-x[i] > print (xnew) [1] 74 3 8

Add a comment
Know the answer?
Add Answer to:
use Rstudio 1. Write a for loop that prints the first four numbers of the vector:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT