
Henrique, Obrigado, a sua dica também funcionou. Saudações, -- Thiago V. dos Santos PhD student Land and Atmospheric Science University of Minnesota http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/inde... Phone: (612) 323 9898 ________________________________ From: Henrique Dallazuanna <wwwhsd@gmail.com> To: r-br@listas.c3sl.ufpr.br; Thiago V. dos Santos <thi_veloso@yahoo.com.br> Sent: Thursday, August 22, 2013 8:21 PM Subject: Re: [R-br] Extrair string usando padrão de caracteres Tente assim: gsub("^(.*)-.*", "\\1", basename(i)) On Thu, Aug 22, 2013 at 7:34 PM, Thiago V. dos Santos <thi_veloso@yahoo.com.br> wrote: Olá pessoal,
Digamos que eu tenha uma lista com os nomes de vários arquivos:
i <- c("./maize-yield.csv", "./rice-yield.csv", "./soybean-yield.csv", "./sugarcane-yield.csv", "./wheat-yield.csv")
e eu precise extrair os caracteres após a barra ("/") e antes do hífen ("-") , ou seja, o nome das culturas.
Qual comando ou combinação de comandos eu devo usar para chegar ao seguinte resultado?
ii [1] "maize" "rice" "soybean" "sugarcane" "wheat"
Agradece desde já, -- Thiago V. dos Santos PhD student Land and Atmospheric Science University of Minnesota http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/inde... Phone: (612) 323 9898 _______________________________________________ R-br mailing list R-br@listas.c3sl.ufpr.br 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.
-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O