First time here hehe. I know that probably my question is a dumb one but I couldn't find the answer with the others questions I've looked into.
I'm trying to convert a string vector (from a larger data frame) which indicates the bands preferences into "1" and "0", being 1 for a specific band and 0 for all others. However, my code is working fine when I use print(), without assigning the results. When I try to use return() or another assignment mode, It comes with an error or only one value. Here is my code:
for(x in ){ if('Pb&C' %in% x){ print(1)} else{ print(0)} } } How can I get the results into a vector?
I've tried these, but all with errors:
for (x in rejeicao) { if ('Pb&C' %in% x) { a <- return(1) } else{ a <- return(0) } } a and also:
for (x in rejeicao) { if ('Pb&C' %in% x) { a[x,] <- return(1) } else{ a[x,] <- return(0) } } thank you very much