<div dir="ltr"><br>library(tidyverse)<br>library(vroom)<br><br>myfile<-vroom("<a href="https://raw.githubusercontent.com/Leprechault/trash/main/result_imgall_f_test.txt">https://raw.githubusercontent.com/Leprechault/trash/main/result_imgall_f_test.txt</a>", delim = "\t")<br><br>myfile <- myfile %>% rename(dados = `Start processing imgall/sample_59178.jpg`)<br><br><br>myfile$dados<br><br>myfile %>% <br> filter(str_detect(dados, "top|sample")) %>% <br> filter(!str_detect(dados, "Predict")) %>% <br> separate(dados, c("Start", "obj_id"), sep = "/") %>% <br> as.data.frame() %>% <br> mutate(Start = ifelse(Start == "Start processing imgall",NA,Start)) %>% <br> separate(Start, c("lca", "left","top","width","height"), sep= ": ") %>% <br> mutate_all(parse_number) %>% <br> fill(., .direction = "downup", obj_id) %>% na.omit() %>% <br> select(left, top,width,height,obj_id,lca) %>%<br> mutate(obj_id = paste0("sample_",obj_id))<br><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><p class="MsoNormal"><b><span style="font-family:Verdana,sans-serif;color:rgb(102,102,102)"><br></span></b></p><p class="MsoNormal"><b><span style="font-family:Verdana,sans-serif;color:rgb(102,102,102)"><br></span></b></p><p class="MsoNormal"><b><span style="font-family:Verdana,sans-serif;color:rgb(102,102,102)"><br></span></b></p><p class="MsoNormal"><b><span style="font-family:Verdana,sans-serif;color:rgb(102,102,102)">Cid Edson Mendonça Póvoas<br>
</span></b><b><span style="font-size:10pt;font-family:Verdana,sans-serif;color:rgb(102,102,102)">Cel: +55 (73) 99151-9565</span></b><span></span></p>
<p class="MsoNormal"><b><span style="font-size:10pt;font-family:Verdana,sans-serif;color:rgb(102,102,102)">Engenheiro </span></b><font color="#666666" face="Verdana, sans-serif"><span style="font-size:13.3333px"><b><span></span>Agrônomo</b></span></font></p><p class="MsoNormal"><font color="#666666" face="Verdana, sans-serif"><span style="font-size:13.3333px"><b>Analista de dados </b></span></font></p>
<p class="MsoNormal"><b><span style="font-size:10pt;font-family:Verdana,sans-serif;color:rgb(102,102,102)">Técnico em Segurança do Trabalho </span></b><span></span></p>
<p class="MsoNormal"><b><span style="font-size:10pt;font-family:Verdana,sans-serif;color:rgb(102,102,102)">LinkedIn: </span></b><b><span style="font-size:10pt;font-family:Verdana,sans-serif;color:rgb(0,176,240)"><a href="http://br.linkedin.com/in/cidedson/" target="_blank"><span style="color:rgb(0,176,240)">http://br.linkedin.com/in/cidedson/</span></a></span></b><span></span></p>
<p class="MsoNormal"><b><span style="font-size:10pt;font-family:Verdana,sans-serif;color:rgb(102,102,102)">Lattes: </span></b><b><span style="font-size:10pt;font-family:Verdana,sans-serif;color:rgb(0,176,240)"><a href="http://lattes.cnpq.br/2303498368142537" target="_blank"><span style="color:rgb(0,176,240)">http://lattes.cnpq.br/2303498368142537</span></a></span></b><b><span style="font-size:10pt;font-family:Verdana,sans-serif"><span></span></span></b></p>
<p class="MsoNormal"><br></p></div></div></div></div></div></div></div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em qui., 12 de nov. de 2020 às 09:44, ASANTOS por (R-br) <<a href="mailto:r-br@listas.c3sl.ufpr.br">r-br@listas.c3sl.ufpr.br</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Bom dia Membros,<br>
<br>
Eu gostaria de realizar a manipulação de um *txt para uso de algumas <br>
informações como variáveis em um data frame a ser criado. Em meu exemplo:<br>
<br>
#Pacote<br>
library(tidyverse)<br>
<br>
# Leitura do arquivo<br>
myfile<-read_lines("<a href="https://raw.githubusercontent.com/Leprechault/trash/main/result_imgall_f_test.txt" rel="noreferrer" target="_blank">https://raw.githubusercontent.com/Leprechault/trash/main/result_imgall_f_test.txt</a>")<br>
<br>
# Visualização parcial da informação contida no *txt<br>
# [1] "Start processing imgall/sample_59178.jpg"<br>
# [2] "imgall/sample_59178.jpg: Predicted in 7337.640000 milli-seconds."<br>
# [3] "End"<br>
# [4] "Start processing imgall/sample_34773.jpg"<br>
# [5] "imgall/sample_34773.jpg: Predicted in 7376.639000 milli-seconds."<br>
# [6] "End"<br>
# [7] "Start processing imgall/sample_24908.jpg"<br>
# [8] "imgall/sample_24908.jpg: Predicted in 7412.858000 milli-seconds."<br>
# [9] "End"<br>
#[10] "Start processing imgall/sample_18922.jpg"<br>
#[11] "imgall/sample_18922.jpg: Predicted in 7424.998000 milli-seconds."<br>
#[12] "End"<br>
#[13] "Start processing imgall/sample_31653.jpg"<br>
#[14] "imgall/sample_31653.jpg: Predicted in 7311.578000 milli-seconds."<br>
#[15] "lca: 90.681282%\tleft_x: 18\ttop_y: 33\twidth: 18\theight: 30"<br>
#[16] "End"<br>
#[17] "Start processing imgall/sample_17341.jpg"<br>
#[18] "imgall/sample_17341.jpg: Predicted in 7418.365000 milli-seconds."<br>
#[19] "End"<br>
#[20] "Start processing imgall/sample_11440.jpg"<br>
#[21] "imgall/sample_11440.jpg: Predicted in 7365.160000 milli-seconds."<br>
#[22] "lca: 66.567978%\tleft_x: 54\ttop_y: 34\twidth: 18\theight: 23"<br>
#[23] "lca: 33.219677%\tleft_x: 74\ttop_y: 15\twidth: 23\theight: 22"<br>
#[24] "End"<br>
<br>
<br>
#Como output final eu gostaria de ter o seguinte dataframe:<br>
<br>
#[1] left top width height obj_id lca<br>
#[2] 54 34 18 23 sample_11440 66.567978<br>
#[3] 74 15 23 22 sample_11440 33.219677<br>
#[4] 1 38 19 28 sample_40452 66.658073<br>
<br>
#Estou tentando algo com o pacote tidyverse, mas sem sucesso e com muita <br>
dificuldade em isolar o que esta após "imgall/" e recuperar o que está <br>
contido após "\t" :<br>
<br>
names_col <- c("left", "top", "width", "height", "obj_id","lca")<br>
<br>
mydf <- myfile %>%<br>
str_subset("lca$") %>%<br>
enframe(name = NULL) %>%<br>
separate(col = value, into = names_col, sep = "[\t]")<br>
mydf<br>
# A tibble: 0 x 6<br>
# ... with 6 variables: left <dbl>, top <dbl>, width <dbl>, height <br>
<dbl>, obj_id <dbl>, lca <dbl<br>
<br>
<br>
#Dicas e/ou sugestões. Obrigado!<br>
<br>
-- <br>
Alexandre dos Santos<br>
Geotechnologies and Spatial Statistics applied to Forest Entomology<br>
Instituto Federal de Mato Grosso (IFMT) - Campus Caceres<br>
Caixa Postal 244 (PO Box)<br>
Avenida dos Ramires, s/n - Vila Real<br>
Caceres - MT - CEP 78201-380 (ZIP code)<br>
Phone: (+55) 65 99686-6970 / (+55) 65 3221-2674<br>
Lattes CV: <a href="http://lattes.cnpq.br/1360403201088680" rel="noreferrer" target="_blank">http://lattes.cnpq.br/1360403201088680</a><br>
OrcID: <a href="http://orcid.org/0000-0001-8232-6722" rel="noreferrer" target="_blank">orcid.org/0000-0001-8232-6722</a><br>
ResearchGate: <a href="http://www.researchgate.net/profile/Alexandre_Santos10" rel="noreferrer" target="_blank">www.researchgate.net/profile/Alexandre_Santos10</a><br>
Publons: <a href="https://publons.com/researcher/3085587/alexandre-dos-santos/" rel="noreferrer" target="_blank">https://publons.com/researcher/3085587/alexandre-dos-santos/</a><br>
--<br>
<br>
_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br>
</blockquote></div>