Displaying 2 results from an estimated 2 matches for "prueba12".
Did you mean:
prueba1
2020 Sep 10
5
aplicar codigo
Hola:
Como dice Carlos, algo así, por ejemplo:
transforma <- function(df) sapply(df, function(x)
ifelse(x%in%c("x1","x2","x3"),
"prueba1",ifelse(x%in%c("x4","x5","x6"),"prueba2",x)))
> transforma(df1)
col1
[1,] "prueba1"
[2,] "prueba1"
[3,] "x11"
[4,]
2020 Sep 10
2
aplicar codigo
...#39;,'x2', 'x4','x6', 'x5')
>
> df1<-data.frame(col1)
> df2<-data.frame(col2)
> df3<-data.frame(col3)
>
> transforma <- function(df) sapply(df, function(x)
> ifelse(x%in%c("x1","x2","x3"),
> "prueba12",ifelse(x%in%c("x4","x5","x6"),"prueba2",x)))
>
> transforma(df1)
> col1
> [1,] "prueba12"
> [2,] "prueba12"
> [3,] "2"
> [4,] "prueba12"
> [5,] "4"
> [6,] "prueba12"...