<div dir="ltr">Tente assim:<div><br></div><div>gsub("^(.*)-.*", "\\1", basename(i))<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 22, 2013 at 7:34 PM, Thiago V. dos Santos <span dir="ltr"><<a href="mailto:thi_veloso@yahoo.com.br" target="_blank">thi_veloso@yahoo.com.br</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div style="font-family:'times new roman','new york',times,serif;font-size:12pt">
<span>Olá pessoal,</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><span><br></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">
<span>Digamos que eu tenha uma lista com os nomes de vários arquivos:</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">
<span><br></span></div><div style="background-color:transparent">i <- c("./maize-yield.csv", "./rice-yield.csv",
"./soybean-yield.csv", "./sugarcane-yield.csv", "./wheat-yield.csv")<br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">
<br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><span style="font-size:12pt">e eu precise extrair os caracteres após a barra ("/") e antes do hífen ("-") , ou seja, o nome das culturas.</span><br>
</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><span style="font-size:12pt"><br></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">
<span style="font-size:12pt">Qual comando ou combinação de comandos eu devo usar para chegar ao seguinte resultado?</span></div><div style="font-style:normal;font-size:12pt;background-color:transparent;font-family:'times new roman','new york',times,serif">
<span style="font-size:12pt"><br></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><span style="font-size:12pt">> ii</span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><span style="font-size:12pt">[1] "maize" "rice" "soybean" "sugarcane" "wheat"</span></div>
<div style="font-family:'times new roman','new york',times,serif;font-size:12pt"><br></div><div style="font-family:'times new roman','new york',times,serif;font-size:12pt">Agradece desde já,<br>
--<br>Thiago V. dos Santos<br>PhD student<br>Land and Atmospheric Science<br>University of Minnesota<br><a href="http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/index.htm" target="_blank">http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/index.htm</a><br>
Phone: <a href="tel:%28612%29%20323%209898" value="+556123239898" target="_blank">(612) 323 9898</a></div></div></div><br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>
Henrique Dallazuanna<br>Curitiba-Paraná-Brasil<br>25° 25' 40" S 49° 16' 22" O
</div>