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 <[email protected]>
To: [email protected]; Thiago V. dos Santos <[email protected]> 
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 <[email protected]> 
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
>[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.
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O 
_______________________________________________
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.

Responder a