[R-br] Extrair string usando padrão de caracteres

Thiago V. dos Santos thi_veloso em yahoo.com.br
Sexta Agosto 23 00:21:23 BRT 2013


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/index.htm
Phone: (612) 323 9898


________________________________
 From: Henrique Dallazuanna <wwwhsd em gmail.com>
To: r-br em listas.c3sl.ufpr.br; Thiago V. dos Santos <thi_veloso em 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 em 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/index.htm
>Phone: (612) 323 9898
>_______________________________________________
>R-br mailing list
>R-br em 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 
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20130822/46dd4ead/attachment.html>


Mais detalhes sobre a lista de discussão R-br