I have a string:
> all_scn[1]
[1] "Cars_20160601_01.hdf5"
I want to use it to repeat some numbers based on a variable last_step:
> last_step
[1] 439
if-else statement:
> ifelse(substring(all_scn[1], 1, 1)=="C",
rep(seq(0, last_step-1, 1), 13),
rep(seq(0, last_step-1, 1), 12))
[1] 0
But you see that instead of repeating a numeric vector of 0:438, 13 times, it just produces zero. Outside ofifelse I get following:
> rep(seq(0, last_step-1, 1), 13)
[1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
[30] 29 30 31 32 . . . (I truncated the output due to space limitation)
What am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire