Recién lo hice como me recomendó Emilio y funcionó, gracias! El mar, 14 dic 2021 a las 12:25, juan manuel dias (<juamad...@gmail.com>) escribió:
> de esa forma me arroja el mismo error! > > Error: Problem with `mutate()` column `sub_label`. > i `sub_label = `%>%`(...)`. > i `sub_label` must be size 3136 or 1, not 1507. > > El mar, 14 dic 2021 a las 12:18, juan manuel dias (<juamad...@gmail.com>) > escribió: > >> Muchas gracias! Creo que lo resolví así >> >> aaa<-listado_nuevo %>% >> mutate(sub_label = stringr::str_split(listado_nuevo$`Descripción >> ítem`,";") %>% >> map_chr(.,1)) >> >> El mar, 14 dic 2021 a las 12:12, Emilio L. Cano (<emilopezc...@gmail.com>) >> escribió: >> >>> Hola, >>> Si lo usas dentro de mutate, tienes que hacerlo sobre la variable del >>> data.frame. Es decir, te sobraría listado_nuevo$ >>> >>> Un saludo, >>> >>> Emilio L. Cano >>> http://emilio.lcano.com >>> >>> >>> >>> >>> > El 14 dic 2021, a las 16:09, juan manuel dias <juamad...@gmail.com> >>> escribió: >>> > >>> > Hola, como andan! >>> > >>> > Tengo un data frame y una de las variables es una cadena larga...de la >>> cuál solo necesito quedarme con la cadena que llega hasta un punto y coma >>> (;). >>> > >>> > El texto es así: >>> > >>> > texto<-c("S. TRANSPORTE DE VACUNAS; DESCRIPCION: TRANSPORTE DE >>> VACUNAS","SERV. DE ALMACENAMIENTO; DESCRIPCION: SERVICIO DE ALMACENAMIENTO" >>> ) >>> > >>> > s<-str_split(texto, pattern = fixed(";"), simplify = TRUE) >>> > s >>> > >>> > <image.png> >>> > >>> > En principio esto funciona así como está, pero cuándo lo incluyo >>> dentro de un objeto tidy >>> > >>> > mutate (primer_desc_item=(str_split(listado_nuevo$`Descripción >>> ítem`, pattern = fixed(";"), simplify = TRUE))) >>> > >>> > Se me complica y me sale el siguiente error. >>> > >>> > Error: Problem with `mutate()` column `primer_desc_item`. >>> > i `primer_desc_item = (...)`. >>> > i `primer_desc_item` must be size 3136 or 1, not 1507. >>> > Run `rlang::last_error()` to see where the error occurred. >>> > >>> > Se les ocurre que puede estar pasando? >>> > >>> > Muchas gracias! Juan. >>> > _______________________________________________ >>> > R-help-es mailing list >>> > R-help-es@r-project.org >>> > https://stat.ethz.ch/mailman/listinfo/r-help-es >>> >>> [[alternative HTML version deleted]] _______________________________________________ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es