Displaying 1 result from an estimated 1 matches for "quiero_s".
Did you mean:
quiero_p
2011 Oct 11
4
apply
...tado final
(deseado).
# creo algunos datos
x<-c(1,2,3,4,5,6)
y<-c(1,2,''p'',''s'',''s'',''p'')
# Lo deseo acomodar de la siguiente forma (estilo survival)
quiero_p <-c(NA,NA,''p'',NA,NA,''p'')
quiero_s <-c(NA,NA,NA,''s'',''s'',NA)
entonces_quiero<-data.frame(x,y,quiero_p,quiero_s)
entonces_quiero
# funcion para el caso ''s''
ver <- function(x){
if (x==''s'') {y <- ''s''
return(y)}...