Skip to content
Prev 319064 / 398506 Next

Substitute value

Hi
It is not perfect solution but

lll<-strsplit(sim.code, ".", fixed=T)

gives you a list of splitted data

index<-which(sapply(lll, length)==3)

gives you values of list with only 3 elements

after that some clever solution must exist but if the list is not big I would go further with for cycle

for(i in index) lll[[i]] <-c(lll[[i]], 1)

This put 1 in each empty slot of list lll. After that you cen either to put everything back by paste or do whatever you like.

Regards
Petr