Last answered:

06 Jan 2022

Posted on:

03 Jan 2022

0

For loops in R Programming

*From your lecture you did this .

title <- c("Catch", "me", "if", "you", "can")

new.title <- vector (lenght = 5)

for (i in 1:5) {
  new.title[i] <- title[i]
}

----------------------------------------------------------------------

*if i do this, am i still in order, even though i arrived at same output



title <- c("Catch", "me", "if", "you", "can")
new.title <- c(1:5)

for (i in 1:5) {
  new.title[i] <- title[i]
}

1 answers ( 0 marked as helpful)
Instructor
Posted on:

06 Jan 2022

0

Hi Ashakah,
both solutions you've shown give the same result, so you're approach is correct, as well.
Well done!

Best,
365 Eli

Submit an answer