{"id":7432,"date":"2015-01-05T14:48:30","date_gmt":"2015-01-05T13:48:30","guid":{"rendered":"http:\/\/www.wjst.de\/blog\/?p=7432"},"modified":"2024-09-19T17:25:21","modified_gmt":"2024-09-19T15:25:21","slug":"rstudio-knitr-rmarkdown2-and-bash","status":"publish","type":"post","link":"https:\/\/www.wjst.de\/blog\/sciencesurf\/2015\/01\/rstudio-knitr-rmarkdown2-and-bash\/","title":{"rendered":"Rstudio, knitr (Rmarkdown2) and bash"},"content":{"rendered":"<p>I couldn&#8217;t find any example online how to revise my R code getting the exif data from pictures<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nfn &lt;- c(&quot;\/usr\/local\/bin\/exiftool \/Users\/wjst\/Desktop\/white.tif&quot;)\r\ninfo &lt;- system(fn,inter=TRUE,wait=TRUE)\r\n<\/pre>\n<p>when moving now to knitr. So here is what worked for me as a replacement including the parsing<br \/>\nof exiftool output.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n```{r, engine=&#039;bash&#039;, echo=FALSE}\r\n\/usr\/local\/bin\/exiftool \/Users\/wjst\/Desktop\/white.tif &gt;\/Users\/wjst\/Desktop\/white.txt\r\n```\r\n```{r Exif, echo=FALSE}\r\nfn &lt;- &#039;\/Users\/wjst\/Desktop\/white.txt&#039;\r\ninfo &lt;- paste(readLines(fn))\r\ninfo &lt;- strsplit(info,&quot;&#x5B;:]{1}&#x5B; ]{1}&quot;)\r\ninfo &lt;- matrix(data=unlist(info), ncol = 2, byrow = TRUE)\r\ninfo &lt;- gsub(&quot;(^&#x5B;&#x5B;:space:]]+|&#x5B;&#x5B;:space:]]+$)&quot;, &quot;&quot;, info)\r\n```\r\n*Exif*\r\n`r kable(info)`\r\n<\/pre>\n\n<p>&nbsp;<\/p>\n<div class=\"bottom-note\">\n  <span class=\"mod1\">CC-BY-NC Science Surf , accessed 12.04.2026<\/span>\n <\/div>","protected":false},"excerpt":{"rendered":"<p>I couldn&#8217;t find any example online how to revise my R code getting the exif data from pictures fn &lt;- c(&quot;\/usr\/local\/bin\/exiftool \/Users\/wjst\/Desktop\/white.tif&quot;) info &lt;- system(fn,inter=TRUE,wait=TRUE) when moving now to knitr. So here is what worked for me as a replacement including the parsing of exiftool output. &#8220;`{r, engine=&#039;bash&#039;, echo=FALSE} \/usr\/local\/bin\/exiftool \/Users\/wjst\/Desktop\/white.tif &gt;\/Users\/wjst\/Desktop\/white.txt &#8220;` &#8220;`{r Exif, &hellip; <a href=\"https:\/\/www.wjst.de\/blog\/sciencesurf\/2015\/01\/rstudio-knitr-rmarkdown2-and-bash\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Rstudio, knitr (Rmarkdown2) and bash<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[2893,2929,2930,2931,2610],"class_list":["post-7432","post","type-post","status-publish","format-standard","hentry","category-computer-software","tag-r","tag-exif","tag-knitr","tag-rmarkdown","tag-system"],"_links":{"self":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts\/7432","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/comments?post=7432"}],"version-history":[{"count":3,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts\/7432\/revisions"}],"predecessor-version":[{"id":24057,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts\/7432\/revisions\/24057"}],"wp:attachment":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/media?parent=7432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/categories?post=7432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/tags?post=7432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}