daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. FLAG <- c("A","B","C","A","D","D")
  2. VALOR <- c("GRA","VE","DT","RT","MM","SS")
  3.  
  4. datos <- data.table(FLAG,VALOR)
  5. datos <- datos[,VALOR2:=rep("vacio",nrow(datos))]
  6. for (i in 1:nrow(datos)){
  7.   datos$VALOR2[i] <- ifelse(datos$FLAG[i]=='A',datos$VALOR[i],datos$VALOR2[i-1])
  8. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top