Encontrei essa discussão aqui pode ser que lhe ajude: https://stackoverflow.com/questions/33221603/r-lubridate-returns-unwanted-century-when-given-two-digit-year
Em ter., 28 de nov. de 2023 às 09:15, Ronaldo Alves por (R-br) < [email protected]> escreveu: > Bom dia! > > Tente isso: > > library(tidyverse) > library(lubridate) > > df <- data.frame("NASCIMENTO" = c("06-09-99", "25-10-31", "07-01-76", > "10-12-50")) > df > > df <- > df %>% > mutate(NASCIMENTO2 = dmy(NASCIMENTO)) %>% > mutate(NASCIMENTO2 = case_when(NASCIMENTO2 > Sys.Date() ~ > format(NASCIMENTO2, "19%y-%m-%d"), > TRUE ~ > format(NASCIMENTO2))) > df > > Abs, > > Ronaldo Alves > > Em ter., 28 de nov. de 2023 às 01:16, Amiko Bh por (R-br) < > [email protected]> escreveu: > >> Pessoal: >> >> Votos de Paz e Bem! >> >> Estou tendo problemas ao converter datas: >> >> *NASCIMENTO* *NASCIMENTO2* >> 06-09-99 1999-09-06 >> 25-10-31 2031-10-25 >> 07-01-76 1976-01-07 >> 10-12-50 2050-12-10 >> Para criar a coluna NASCIMENTO2 usei >> df$NASCIMENTO2 = dmy(df$NASCIMENTO) >> >> linhas 1 e 3, certo = 1999 e 1976 >> linhas 2 e 4, errado = 2031 ao invés de 1931 e 2050 ao invés de 1950. >> Não consegui encontrar auxílio pesquisando no fórum. >> Solicito ajuda. >> Muito obrigado. >> _______________________________________________ >> R-br mailing list >> [email protected] >> https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br >> Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça >> código mínimo reproduzível. >> > _______________________________________________ > R-br mailing list > [email protected] > https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br > Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça > código mínimo reproduzível. >
_______________________________________________ R-br mailing list [email protected] https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código mínimo reproduzível.
