0

I am trying to change the name of dataset by using loop but it did not work. Below is my code:

    for ( i in 6) {
    nam<-paste("CAT", i,sep=".")
    assign(nam, data_out[i])
    }

Only "CAT.6" was assigned to the data set. What about others i ?

Many thanks in advance !

Regards, Bartek

Mohere
  • 45
  • 5
haver24
  • 241
  • 2
  • 5
  • 11

1 Answers1

1

As Usobi said, your loop has an error. Change the loop to be for(i in 1:6) and it will work. Why? Because for(i in 6) tells R to iterate i through the set consisting of 6, hence, you get one output (CAT.6).

Community
  • 1
  • 1
TARehman
  • 6,659
  • 3
  • 33
  • 60