Displaying 2 results from an estimated 2 matches for "dtnew".
Did you mean:
dnew
2016 Nov 24
2
Dos pequeños códigos casi idénticos y sólo funciona el primero
...),
coche = factor(c('A', 'B', 'U', 'W', 'B')), envio = factor(rep(c(T, F), c(3, 2))))
En el siguiente codigo, segun la dupla (caso, empresa), se eliminan las filas coche="B" si envio=T, y se cambia "B" por "A" si envio = F.
DTnew <- DT[, ## CODIGO QUE SÍ FUNCIONA
if (all(envio == T)) list(coche = coche[which(coche != "B")])
else list(coche),
by = list(caso, empresa)][, coche := as.factor(ifelse(coche == "B", "A", as.character(coche))) ]
caso empresa coche
1: 1...
2013 Jul 24
3
Change values in a dateframe
Hello
I have the following problem :
The dataframe TEST has multiple lines for a same person because :
there are differents values of Nom or differents values of Prenom
but the values of Matricule or Sexe or Date.de.naissance are the same.
TEST <- structure(list(Matricule = c(66L, 67L, 67L, 68L, 89L, 90L, 90L,
91L, 108L, 108L, 108L), Nom = structure(c(1L, 2L, 2L, 4L, 8L,
5L, 6L, 9L, 3L, 3L,