Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 49 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  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