Hello,
I wrote a small function to change row values over some columns.
I mea, I just copy some column values from rows x to rows y. And I declared "v" as a condition in order to change a value to 1.
edic_c <- function(x,y,v) {
dataz[y,3]=dataz[x,3]
dataz[y,4]=dataz[x,4]
dataz[y,12]=0
if (v==1) {
dataz[x,12]=1
}
}
But when I tried to applied, in some rows, I just simply didn't preserve the change I declared.
I don't know if tha't because I am mixing a data frame nd a tibble object or anything related.
Here I am listing the rows 1589 and 1590. They should appear with the values from 125, but It doesn't.
edic_c(125,1589,0)
daaz>%filter(orden %in% c(125,1589,1590))
flip src num1 num2 lastN
<chr> <chr> <dbl> <chr>
1 NA 14 - … 1.30e7 9 ALE
2 NA 17 - … NA NA ALE
3 NA 17 - … NA NA ALE
If I manueally declare this, It works...
dataz[1589,3]=dataz[125,3]
dataz[1589,4]=dataz[125,4]
dataz[1589,12]=0
Can you guide me, please?
Thanks for your time and interest.