Replies: 1 comment
-
|
You can let Q1.1 be a vector
And then, inside the loop assign to the corresponding entry of the vector the output of print.
For Q1.2 and Q1.2, the loop is not index by a sequence (e.g., 1:4), in that case you will need to keep track of iteration number. E.G. counter=0 for(x in c('a','b','d','c')){ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Gabriel Hepker asked:
"Hello, I am working on the in-class 3 assignment, and I am having a hard time trying to store the outputs of the for loops as a vector. For the example below, I tried to assign the Q1.1 to the print(x) outputs of the for loops and store it as a vector named Q1.1. However, it only shows the fourth output value of the for loop when printing out the Q1.1 vector. When possible, please let me know of potential solutions on how to print out all outputs of a for loop and to store as a vector. Thank you."
Beta Was this translation helpful? Give feedback.
All reactions