<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>1 | Pablo Bernabeu</title><link>https://pablobernabeu.github.io/publication_types/1/</link><atom:link href="https://pablobernabeu.github.io/publication_types/1/index.xml" rel="self" type="application/rss+xml"/><description>1</description><generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-uk</language><copyright>Pablo Bernabeu, 2015—2026. Licence: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Email: pcbernabeu@gmail.com. Cookies only used by third-party systems such as [Disqus](https://help.disqus.com/en/articles/1717155-use-of-cookies).</copyright><lastBuildDate>Fri, 01 Jan 2021 00:00:00 +0000</lastBuildDate><image><url>https://pablobernabeu.github.io/img/default_preview_image.jpg</url><title>1</title><link>https://pablobernabeu.github.io/publication_types/1/</link></image><item><title>WebVTT caption transcription app</title><link>https://pablobernabeu.github.io/applications-and-dashboards/vtt-transcription-app/</link><pubDate>Fri, 01 Jan 2021 00:00:00 +0000</pubDate><guid>https://pablobernabeu.github.io/applications-and-dashboards/vtt-transcription-app/</guid><description>
&lt;div id="how-it-works" class="section level3">
&lt;h3>How it works&lt;/h3>
&lt;div class="mermaid">
graph TD
A["User uploads WebVTT file (vtt or txt)"] --> B["Regular expressions remove metadata such as timestamps"]
B --> C["Text formatted into a paragraph"]
C --> D["Result displayed on the website"]
D --> E["Download as docx or txt document"]
&lt;/div>
&lt;p>&lt;em>Schematic overview; see the text for details.&lt;/em>&lt;/p>
&lt;p>This open-source, R-based web application converts video captions (subtitles) from the &lt;a href="https://www.w3.org/TR/webvtt1/">Web Video Text Tracks (WebVTT) Format&lt;/a> into plain text. For this purpose, users upload a WebVTT file with the extension &lt;code>.vtt&lt;/code> or &lt;code>.txt&lt;/code> (examples available &lt;a href="https://github.com/pablobernabeu/VTT-Transcription-App/blob/main/assets/Example_subtitles_1.vtt">here&lt;/a> and &lt;a href="https://github.com/pablobernabeu/VTT-Transcription-App/blob/main/assets/Example_subtitles_2.txt">here&lt;/a>).&lt;/p>
&lt;script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fpablobernabeu%2FVTT-Transcription-App%2Fblob%2Fmain%2Fassets%2FExample_subtitles_1.vtt&amp;style=a11y-dark&amp;type=code&amp;showLineNumbers=on&amp;showFileMeta=on&amp;showCopy=on&amp;fetchFromJsDelivr=on">&lt;/script>
&lt;p>&lt;a href="https://osf.io/download/ustmx">&lt;strong>Download VTT file&lt;/strong>&lt;/a>&lt;/p>
&lt;p>When the caption file is uploaded to the web application, metadata such as timestamps are automatically removed, and the text is formatted into a paragraph. The result is displayed on the website, and can be downloaded as &lt;code>.docx&lt;/code> and &lt;code>.txt&lt;/code> documents. Overall, this application serves to improve the accessibility of video captions.&lt;/p>
&lt;p>The data is only available to the user, and is deleted when the website is closed.&lt;/p>
&lt;/div>
&lt;div id="web-application" class="section level2">
&lt;h2>&lt;i class="fa-solid fa-globe">&lt;/i> Web application&lt;/h2>
&lt;p>The application can be used below, or it can be &lt;a href="https://pablo-bernabeu.shinyapps.io/VTT-Transcription-App">opened separately here&lt;/a>.&lt;/p>
&lt;div style="margin-bottom: 25px;">
&lt;div style="position: relative; padding-top: 56.25%; height: 1100px;">
&lt;iframe src="https://pablo-bernabeu.shinyapps.io/VTT-Transcription-App" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;">
&lt;/iframe>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;div id="programming-details" class="section level2">
&lt;h2>Programming details&lt;/h2>
&lt;p>The &lt;a href="https://github.com/pablobernabeu/VTT-transcription">source code is available on Github&lt;/a>, where the app can be extended via pull requests. Questions and suggestions can be submitted as &lt;a href="https://github.com/pablobernabeu/VTT-transcription/issues">issues&lt;/a> or emailed to &lt;a href="mailto:pcbernabeu@gmail.com" class="email">pcbernabeu@gmail.com&lt;/a>. The licence is &lt;a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International&lt;/a>.&lt;/p>
&lt;p>The core of the application is in the &lt;a href="https://github.com/pablobernabeu/VTT-Transcription-App/blob/main/index.Rmd">index.Rmd&lt;/a> script, which uses ‘&lt;a href="https://stringr.tidyverse.org/articles/regular-expressions.html">regular expressions&lt;/a>’ to process the VTT file.&lt;/p>
&lt;script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fpablobernabeu%2FVTT-Transcription-App%2Fblob%2Fmain%2Findex.Rmd%23L172-L188&amp;style=a11y-dark&amp;type=code&amp;showLineNumbers=on&amp;showFileMeta=on&amp;showCopy=on&amp;fetchFromJsDelivr=on">&lt;/script>
&lt;p>In turn, the script above draws on &lt;a href="https://github.com/pablobernabeu/VTT-Transcription-App/blob/main/assets/VTT-Transcription-App_doc_renderer.Rmd">the one below&lt;/a> to enable the download of &lt;code>.docx&lt;/code> documents. Last, the latter script draws on &lt;a href="https://github.com/pablobernabeu/VTT-Transcription-App/blob/main/assets/VTT-Transcription-App-format-template.docx">this Word template&lt;/a>.&lt;/p>
&lt;script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fpablobernabeu%2FVTT-Transcription-App%2Fblob%2Fmain%2Fassets%2FVTT-Transcription-App_doc_renderer.Rmd%23L1-L13&amp;style=a11y-dark&amp;type=code&amp;showLineNumbers=on&amp;showFileMeta=on&amp;showCopy=on&amp;fetchFromJsDelivr=on">&lt;/script>
&lt;/div></description></item><item><title>Web application for the simulation of experimental data</title><link>https://pablobernabeu.github.io/applications-and-dashboards/experimental-data-simulation/</link><pubDate>Mon, 01 Jun 2020 00:00:00 +0000</pubDate><guid>https://pablobernabeu.github.io/applications-and-dashboards/experimental-data-simulation/</guid><description>
&lt;div style="font-size: 25px; color: #614064; padding-top: 15px; padding-bottom: 10px;">
&lt;i class="fas fa-chalkboard-teacher fa-xs" aria-hidden="true">&lt;/i> &lt;i class="fas fa-university fa-xs" aria-hidden="true">&lt;/i> Purposes
&lt;/div>
&lt;p>This open-source, R-based web application is suitable for educational and research purposes in experimental and quantitative sciences. It allows the &lt;strong>creation of varied data sets with specified structures, such as between-group and within-participant variables, that can be categorical or continuous.&lt;/strong> These parameters can be set throughout the various tabs (sections) from the top menu. In the last tab, the data set can be downloaded. The benefits of this application include time-saving and flexibility in the control of parameters.&lt;/p>
&lt;div id="how-it-works" class="section level3">
&lt;h3>How it works&lt;/h3>
&lt;div class="mermaid">
graph TD
A["Set parameters across tabs"] --> B["Define between-group variables"]
A --> C["Define within-participant variables"]
B --> D["Choose categorical or continuous"]
C --> D
D --> E["Simulated data set"]
E --> F["Build custom summary (penultimate tab)"]
F --> G["Download parameters and data set (last tab)"]
&lt;/div>
&lt;p>&lt;em>Schematic overview; see the text for details.&lt;/em>&lt;/p>
&lt;/div>
&lt;div id="guidelines" class="section level3">
&lt;h3>Guidelines&lt;/h3>
&lt;p>General guidelines include the following:&lt;/p>
&lt;ul>
&lt;li>&lt;p>&lt;strong>In the names of variables&lt;/strong>, it is recommended to use only alphanumeric characters and underscore signs. The latter can be used to separate characters or words (e.g., &lt;em>variable_name&lt;/em>). Different names should be used for each variable.&lt;/p>&lt;/li>
&lt;li>&lt;p>&lt;strong>In the levels of categorical variables&lt;/strong>, alphanumeric, special characters and spaces are allowed.&lt;/p>&lt;/li>
&lt;li>&lt;p>&lt;strong>In numeric fields&lt;/strong> (e.g., ‘Mean’, ‘Standard deviation’, ‘Relative probability [0, 1]’), only numbers and decimal points are allowed.&lt;/p>&lt;/li>
&lt;li>&lt;p>&lt;strong>As the data set increases&lt;/strong>, so does the processing time.&lt;/p>&lt;/li>
&lt;/ul>
&lt;p>More specific guidelines are available in each section.&lt;/p>
&lt;/div>
&lt;div id="the-web-application-can-be-launched-here." class="section level3">
&lt;h3>&lt;i class="fa-solid fa-globe">&lt;/i> The web application can be &lt;a href="https://pablo-bernabeu.shinyapps.io/experimental-data-simulation/">launched here&lt;/a>.&lt;/h3>
&lt;div style="padding-top:8px; padding-bottom:2px; margin-bottom:-20px; color:#665F5F;">
Screenshot of the &lt;em>Dependent&lt;/em> tab (&lt;a href="https://github.com/pablobernabeu/Experimental-data-simulation/raw/master/Screenshot.png">view larger&lt;/a>)
&lt;/div>
&lt;p>&lt;img style="max-width: 800px; display: block; margin-left: auto; margin-right: auto; padding-bottom: 15px;" src="https://github.com/pablobernabeu/Experimental-data-simulation/raw/master/Screenshot.png" />&lt;/p>
&lt;/div>
&lt;div id="reference" class="section level3">
&lt;h3>Reference&lt;/h3>
&lt;p>Bernabeu, P., &amp;amp; Lynott, D. (2020). &lt;em>Web application for the simulation of experimental data&lt;/em> (Version 1.4). &lt;a href="https://github.com/pablobernabeu/Experiment-simulation-app/">https://github.com/pablobernabeu/Experiment-simulation-app/&lt;/a>&lt;/p>
&lt;/div>
&lt;div id="code" class="section level3">
&lt;h3>Code&lt;/h3>
&lt;p>This web application was developed in &lt;a href="https://www.r-project.org/about.html">R&lt;/a> (R Core Team, 2020). The code is &lt;a href="https://github.com/pablobernabeu/Experimental-data-simulation/blob/master/index.Rmd">available on Github&lt;/a>, where contributions may be made. The initial code for this application was influenced by Section 5.7 (&lt;a href="https://crumplab.github.io/programmingforpsych/simulating-and-analyzing-data-in-r.html#simulating-data-for-multi-factor-designs" target="_blank">&lt;em>Simulating data for multi-factor designs&lt;/em>&lt;/a>) in Crump (2017). The R packages used include ‘dplyr’ (Wickham, François, Henry, &amp;amp; Müller, 2018), ‘DT’ (Xie, 2020), ‘flexdashboard’ (Iannone, Allaire, &amp;amp; Borges, 2020), ‘shiny’ (Chang, Cheng, Allaire, Xie, &amp;amp; McPherson, 2020) and ‘stringr’ (Wickham, 2019).&lt;/p>
&lt;/div>
&lt;div id="options-for-development-and-local-use-of-the-app" class="section level3">
&lt;h3>Options for development and local use of the app&lt;/h3>
&lt;div id="option-a-using-local-rrstudio-or-rstudio-cloud-project-or-binder-rstudio-environment" class="section level4">
&lt;h4>Option A) Using local R/RStudio or &lt;a href="https://rstudio.cloud/project/1739958">RStudio Cloud project&lt;/a> or &lt;a href="https://mybinder.org/v2/gh/pablobernabeu/Experimental-data-simulation/master?urlpath=rstudio">Binder RStudio environment&lt;/a>&lt;/h4>
&lt;ol style="list-style-type: decimal">
&lt;li>&lt;p>[Step only necessary in R/RStudio] Install the packages in the versions used in the &lt;a href="https://github.com/pablobernabeu/Experimental-data-simulation/releases">latest release of this application&lt;/a>, by running:&lt;/p>
&lt;pre>&lt;code>install.packages(&amp;#39;devtools&amp;#39;)
library(devtools)
install_version(&amp;#39;dplyr&amp;#39;, &amp;#39;1.0.2&amp;#39;, &amp;#39;http://cran.us.r-project.org&amp;#39;)
install_version(&amp;#39;DT&amp;#39;, &amp;#39;0.15&amp;#39;, &amp;#39;http://cran.us.r-project.org&amp;#39;)
install_version(&amp;#39;flexdashboard&amp;#39;, &amp;#39;0.5.2&amp;#39;, &amp;#39;http://cran.us.r-project.org&amp;#39;)
install_version(&amp;#39;htmltools&amp;#39;, &amp;#39;0.5.0&amp;#39;, &amp;#39;http://cran.us.r-project.org&amp;#39;)
install_version(&amp;#39;knitr&amp;#39;, &amp;#39;1.30&amp;#39;, &amp;#39;http://cran.us.r-project.org&amp;#39;)
install_version(&amp;#39;ngram&amp;#39;, &amp;#39;3.0.4&amp;#39;, &amp;#39;http://cran.us.r-project.org&amp;#39;)
install_version(&amp;#39;purrr&amp;#39;, &amp;#39;0.3.4&amp;#39;, &amp;#39;http://cran.us.r-project.org&amp;#39;)
install_version(&amp;#39;shiny&amp;#39;, &amp;#39;1.5.0&amp;#39;, &amp;#39;http://cran.us.r-project.org&amp;#39;)
install_version(&amp;#39;stringr&amp;#39;, &amp;#39;1.4.0&amp;#39;, &amp;#39;http://cran.us.r-project.org&amp;#39;)
install_version(&amp;#39;tidyr&amp;#39;, &amp;#39;1.1.2&amp;#39;, &amp;#39;http://cran.us.r-project.org&amp;#39;)&lt;/code>&lt;/pre>&lt;/li>
&lt;li>&lt;p>Open the &lt;a href="https://github.com/pablobernabeu/Experimental-data-simulation/blob/master/index.Rmd">index.Rmd&lt;/a> script.&lt;/p>&lt;/li>
&lt;li>&lt;p>Run the application by clicking on &lt;kbd>▶️ Run document&lt;/kbd> at the top left, or by running &lt;code>rmarkdown::run('index.Rmd')&lt;/code> in the console.&lt;/p>&lt;/li>
&lt;li>&lt;p>Click on &lt;kbd>Open in Browser&lt;/kbd> at the top left.&lt;/p>&lt;/li>
&lt;/ol>
&lt;/div>
&lt;div id="option-b-using-dockerfile-see-instructions" class="section level4">
&lt;h4>Option B) Using Dockerfile (&lt;a href="https://github.com/pablobernabeu/Experimental-data-simulation#option-b-using-dockerfile-vsochs-pull-request">see instructions&lt;/a>)&lt;/h4>
&lt;/div>
&lt;/div>
&lt;div id="acknowledgements" class="section level3">
&lt;h3>Acknowledgements&lt;/h3>
&lt;p>Thank you to RStudio for the free hosting server used by this application, &lt;a href="https://www.shinyapps.io/">shinyapps.io&lt;/a>.&lt;/p>
&lt;/div>
&lt;div id="references" class="section level3">
&lt;h3>References&lt;/h3>
&lt;p>Chang, W., Cheng, J., Allaire, J., Xie, Y., &amp;amp; McPherson, J. (2020). shiny: Web Application Framework for R. R package version 1.4.0. Available at &lt;a href="http://CRAN.R-project.org/package=shiny">http://CRAN.R-project.org/package=shiny&lt;/a>.&lt;/p>
&lt;p>Crump, M. J. C. (2017). Programming for Psychologists: Data Creation and Analysis (Version 1.1). &lt;a href="https://crumplab.github.io/programmingforpsych/">https://crumplab.github.io/programmingforpsych/&lt;/a>.&lt;/p>
&lt;p>Iannone, R., Allaire, J. J., &amp;amp; Borges, B. (2020). Flexdashboard: R Markdown Format for Flexible Dashboards. &lt;a href="http://rmarkdown.rstudio.com/flexdashboard">http://rmarkdown.rstudio.com/flexdashboard&lt;/a>.&lt;/p>
&lt;p>R Core Team (2020). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL &lt;a href="https://www.R-project.org/">https://www.R-project.org/&lt;/a>.&lt;/p>
&lt;p>Wickham, H. (2019). stringr: Simple, Consistent Wrappers for Common String Operations. R package version 1.4.0. &lt;a href="https://CRAN.R-project.org/package=stringr">https://CRAN.R-project.org/package=stringr&lt;/a>.&lt;/p>
&lt;p>Wickham, H., François, R., Henry, L., &amp;amp; Müller, K. (2018). dplyr: A Grammar of Data Manipulation. R package version 0.7.6. &lt;a href="https://CRAN.R-project.org/package=dplyr">https://CRAN.R-project.org/package=dplyr&lt;/a>.&lt;/p>
&lt;p>Xie, Y. (2020). DT: A Wrapper of the JavaScript Library “DataTables”. R package version 0.14. Available at &lt;a href="https://CRAN.R-project.org/package=DT">https://CRAN.R-project.org/package=DT&lt;/a>.&lt;/p>
&lt;/div>
&lt;div id="contact" class="section level3">
&lt;h3>Contact&lt;/h3>
&lt;p>To submit any questions or feedback, please post &lt;a href="https://github.com/pablobernabeu/Experimental-data-simulation/issues">an issue&lt;/a>, or email Pablo Bernabeu at &lt;a href="mailto:pcbernabeu@gmail.com">pcbernabeu@gmail.com&lt;/a>.&lt;/p>
&lt;/div></description></item><item><title>Data dashboard: Butterfly species richness in Los Angeles</title><link>https://pablobernabeu.github.io/applications-and-dashboards/butterfly-species-richness-in-la/</link><pubDate>Wed, 01 Jan 2020 00:00:00 +0000</pubDate><guid>https://pablobernabeu.github.io/applications-and-dashboards/butterfly-species-richness-in-la/</guid><description>&lt;a href='https://pablobernabeu.github.io/dashboards/Butterfly-species-richness-in-LA'>
&lt;button style = "background-color: white; color: black; border: 2px solid #196F27; border-radius: 12px;">
&lt;h3 style = "margin-top: 7px !important; margin-left: 9px !important; margin-right: 9px !important;">
&lt;span style="color:#DBE6DA;">&lt;/span> Dashboard
&lt;/h3>&lt;/button>
&lt;/a>
&lt;br>
&lt;br>
&lt;h3 id="how-it-works">How it works&lt;/h3>
&lt;p>&lt;em>Schematic overview; see the text for details.&lt;/em>&lt;/p>
&lt;div class="mermaid">
graph TD
A["Open data from Prudic et al. (2018)"] --> B["iNaturalist (citizen science)"]
A --> C["BioScan (traditional traps)"]
B --> D["Transform, merge, and wrangle in R"]
C --> D
D --> E["Dashboard: butterfly species richness in Los Angeles"]
&lt;/div>
&lt;p>This dashboard presents open data (&lt;a href='https://github.com/jcoliver/bioscan/blob/master/data/iNaturalist-clean-reduced.csv'>iNaturalist&lt;/a> and &lt;a href='https://github.com/jcoliver/bioscan/blob/master/data/BioScanDataComplete.csv'>BioScan&lt;/a>) from
&lt;a href="https://doi.org/10.3390/insects9040186">Prudic et al. (2018)&lt;/a>. In their study, Prudic et al. compared citizen science with traditional methods in the measurement of butterfly populations.&lt;/p>
&lt;p>I developed this dashboard after reproducing the
&lt;a href="https://github.com/jcoliver/bioscan">analyses of the original study&lt;/a> in a
&lt;a href="https://github.com/reprohack/reprohack-hq/blob/master/README.md">Reprohack session&lt;/a>.&lt;/p>
&lt;p>My coding tasks included transforming the data to a long format,&lt;/p>
&lt;pre>&lt;code># There are pseudovariables, that is, observations entered as variables.
# Since most R processes need the tidy format, convert below
# (see https://r4ds.had.co.nz/tidy-data.html). The specific numbers
# found through traps and crowdsourcing methods are preserved.
BioScan = BioScan %&amp;gt;% pivot_longer(
cols = Anthocharis_sara:Vanessa_cardui, names_to = &amp;quot;Species&amp;quot;,
values_to = &amp;quot;Number&amp;quot;, values_drop_na = TRUE
)
# Compare
#str(BioScan)
#str(dat)
# 928 rows now; the result of 29 pseudo-variables being transposed
# into rows, interacting with 32 previous rows, i.e., 29 * 32 = 928.
&lt;/code>&lt;/pre>
&lt;p>merging three data sets,&lt;/p>
&lt;pre>&lt;code># The iNaturalist data set presents a challenge that differs from the
# pseudovariables found above. The number of animals of each species
# must be computed from repeated entries, per site.
iNaturalist = merge(iNaturalist,
iNaturalist %&amp;gt;%
count(species, site, name = 'Number'))
&lt;/code>&lt;/pre>
&lt;p>and, as ever, wrangling with the format of the dashboard pages to preserve the format of a table.&lt;/p>
&lt;pre>&lt;code>Species details {style=&amp;quot;background-color: #FCFCFC;&amp;quot;}
=======================================================================
Column {style=&amp;quot;data-width:100%; position:static; height:1000px;&amp;quot;}
-----------------------------------------------------------------------
&lt;/code>&lt;/pre>
&lt;h3 id="reference">Reference&lt;/h3>
&lt;p>Prudic, K. L., Oliver, J. C., Brown, B. V., &amp;amp; Long, E. C. (2018). Comparisons of citizen science data-gathering approaches to evaluate urban butterfly diversity. &lt;em>Insects, 9&lt;/em>(4), 186. &lt;a href="https://doi.org/10.3390/insects9040186">https://doi.org/10.3390/insects9040186&lt;/a>&lt;/p></description></item><item><title>Dutch modality exclusivity norms</title><link>https://pablobernabeu.github.io/applications-and-dashboards/bernabeu-2018-modalitynorms/</link><pubDate>Mon, 01 Jan 2018 00:00:00 +0000</pubDate><guid>https://pablobernabeu.github.io/applications-and-dashboards/bernabeu-2018-modalitynorms/</guid><description>&lt;a href='https://pablobernabeu.shinyapps.io/Dutch-modality-exclusivity-norms'>
&lt;button style = "background-color: white; color: black; border: 2px solid #196F27; border-radius: 12px;">
&lt;h3 style = "margin-top: 7px !important; margin-left: 9px !important; margin-right: 9px !important;">
&lt;span style="color:#DBE6DA;">&lt;/span> Complete web application &lt;font style='font-size:60%;'>&lt;i>Flexdashboard-Shiny&lt;/i>&lt;/font> &lt;/h3>&lt;/button>&lt;/a>
&lt;br>
&lt;br>
&lt;a href='https://pablobernabeu.github.io/dashboards/Dutch-modality-exclusivity-norms'>
&lt;button style = "background-color: white; color: black; border: 2px solid #4CAF50; border-radius: 12px;">
&lt;h3 style = "margin-top: 7px !important; margin-left: 9px !important; margin-right: 9px !important;">
&lt;span style="color:#DBE6DA;">&lt;/span> Reduced dashboard &lt;font style='font-size:60%;'>&lt;i>Flexdashboard&lt;/i>&lt;/font> &lt;/h3>&lt;/button>&lt;/a> &amp;nbsp;
&lt;br>
&lt;br>
&lt;h3 id="how-it-works">How it works&lt;/h3>
&lt;div class="mermaid">
graph TD
A["Dutch modality exclusivity norms data"] --> B["Flexdashboard front-end (R Markdown)"]
B --> C["Shiny back-end (reactive selection and download)"]
C --> D["Info tab: HTML and CSS text plus rmarkdown output"]
C --> E["Table tab: reactable (colours, bar charts)"]
C --> F["Plot tab: plotly (PCA scatter, tooltips)"]
B --> G["Static Flexdashboard-only version on RPubs (Shiny removed)"]
&lt;/div>
&lt;p>&lt;em>Schematic overview; see the text for details.&lt;/em>&lt;/p>
&lt;p>This web application presents linguistic data over several tabs. The code combines the great front-end of Flexdashboard—based on R Markdown and yielding an unmatched user interface—, with the great back-end of Shiny—allowing users to download sections of data they select, in various formats.&lt;/p>
&lt;ul>
&lt;li>
&lt;p>A nice find was the 'reactable' package, which implements Javascript under the hood to allow the use of colours, bar charts, etc.&lt;/p>
&lt;pre>&lt;code>Auditory = colDef(header = with_tooltip('Auditory Rating',
'Mean rating of each word on the auditory modality across participants.'),
cell = function(value) {
width &amp;lt;- paste0(value / max(table_data$Auditory) * 100, &amp;quot;%&amp;quot;)
value = sprintf(&amp;quot;%.2f&amp;quot;, round(value,2)) # Round to two digits, keeping trailing zeros
bar_chart(value, width = width, fill = '#ff3030')
},
align = 'left'),
&lt;/code>&lt;/pre>
&lt;/li>
&lt;li>
&lt;p>One of the hardest nuts to crack was allowing the full functionality of tables—i.e., scaling to screen, frozen header, and vertical and horizontal scrolling—whilst having tweaked the vertical/horizontal orientation of the dashboard sections. Initial clashes were resolved by adjusting the section's CSS styles&lt;/p>
&lt;pre>&lt;code>Table {#table style=&amp;quot;background-color:#FCFCFC;&amp;quot;}
=======================================================================
Inputs {.sidebar style='position:fixed; padding-top: 65px; padding-bottom:30px;'}
-----------------------------------------------------------------------
&lt;/code>&lt;/pre>
&lt;p>and by also adjusting the reactable settings.&lt;/p>
&lt;pre>&lt;code>renderReactable({
reactable(selected_words(),
defaultSorted = list(cat = 'desc', word = 'asc'),
defaultColDef = colDef(footerStyle = list(fontWeight = &amp;quot;bold&amp;quot;)),
height = 840, striped = TRUE, pagination = FALSE, highlight = TRUE,
&lt;/code>&lt;/pre>
&lt;/li>
&lt;li>
&lt;p>A nice feature, especially suited to Flexdashboard, was the use of different formats across tabs. Whereas the Info tab presents long text using HTML and CSS styling, along with rmarkdown code output, the other tabs rely more strongly on Javascript features, enabled by R packages such as ‘shiny’ and sweetalert (e.g., allowing modal dialogs—pop-ups), reactable and plotly (e.g., allowing information opened by hovering—tooltips).&lt;/p>
&lt;pre>&lt;code>```{r}
# reactive for the word bar
highlighted_properties = reactive(input$highlighted_properties)
renderPlotly({
ggplotly(
ggplot( selected_props(), aes(RC1, RC2, label = as.character(word), color = main,
# Html tags below used for format. Decimals rounded to two.
text = paste0(' ', '&amp;lt;span style=&amp;quot;padding-top:3px; padding-bottom:3px; font-size:2.2em; color:#EEEEEE&amp;quot;&amp;gt;', capitalize(word), '&amp;lt;/span&amp;gt; ', '&amp;lt;br&amp;gt;',
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Dominant modality: &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;', main, ' ',
' ', '&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Modality exclusivity: &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;', sprintf(&amp;quot;%.2f&amp;quot;, round(Exclusivity, 2)), '% ',
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Perceptual strength: &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;', sprintf(&amp;quot;%.2f&amp;quot;, round(Perceptualstrength, 2)),
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Auditory rating: &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;', sprintf(&amp;quot;%.2f&amp;quot;, round(Auditory, 2)), ' ',
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Haptic rating: &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;', sprintf(&amp;quot;%.2f&amp;quot;, round(Haptic, 2)), ' ',
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Visual rating: &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;', sprintf(&amp;quot;%.2f&amp;quot;, round(Visual, 2)), ' ',
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Concreteness (Brysbaert et al., 2014): &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;',
sprintf(&amp;quot;%.2f&amp;quot;, round(concrete_Brysbaertetal2014, 2)), ' ',
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Number of letters: &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;', letters, ' ',
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Number of phonemes (DutchPOND): &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;',
round(phonemes_DUTCHPOND, 2), ' ',
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Contextual diversity (lg10CD SUBTLEX-NL): &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;',
sprintf(&amp;quot;%.2f&amp;quot;, round(freq_lg10CD_SUBTLEXNL, 2)), ' ',
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Word frequency (lg10WF SUBTLEX-NL): &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;',
sprintf(&amp;quot;%.2f&amp;quot;, round(freq_lg10WF_SUBTLEXNL, 2)), ' ',
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Lemma frequency (CELEX): &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;',
sprintf(&amp;quot;%.2f&amp;quot;, round(freq_CELEX_lem, 2)), ' ',
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Phonological neighbourhood size (DutchPOND): &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;',
round(phon_neighbours_DUTCHPOND, 2), ' ',
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Orthographic neighbourhood size (DutchPOND): &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;',
round(orth_neighbours_DUTCHPOND, 2), ' ',
'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt; Age of acquisition (Brysbaert et al., 2014): &amp;lt;/span&amp;gt;&amp;lt;b style=&amp;quot;color:#EEEEEE&amp;quot;&amp;gt;',
sprintf(&amp;quot;%.2f&amp;quot;, round(AoA_Brysbaertetal2014, 2)), ' ', '&amp;lt;br&amp;gt; '
) ) ) +
geom_text(size = ifelse(selected_props()$word %in% highlighted_properties(), 7,
ifelse(is.null(highlighted_properties()), 3, 2.8)),
fontface = ifelse(selected_props()$word %in% highlighted_properties(), 'bold', 'plain')) +
geom_point(alpha = 0) + # This geom_point helps to colour the tooltip according to the dominant modality
scale_colour_manual(values = colours, drop = FALSE) + theme_bw() + ggtitle('Property words') +
labs(x = 'Varimax-rotated Principal Component 1', y = 'Varimax-rotated Principal Component 2') +
guides(color = guide_legend(title = 'Main&amp;lt;br&amp;gt;modality')) +
theme( plot.background = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), panel.border = element_blank(),
axis.line = element_line(color = 'black'), plot.title = element_text(size = 14, hjust = .5),
axis.title.x = element_text(colour = 'black', size = 12, margin = margin(15,15,0,15)),
axis.title.y = element_text(colour = 'black', size = 12, margin = margin(0,15,15,5)),
axis.text.x = element_text(size = 8), axis.text.y = element_text(size = 8),
legend.background = element_rect(size = 2), legend.position = 'none',
legend.title = element_blank(),
legend.text = element_text(colour = colours, size = 13) ),
tooltip = 'text'
)
})
# For download, save plot without the interactive 'plotly' part
properties_png = reactive({ ggplot(selected_props(), aes(RC1, RC2, color = main, label = as.character(word))) +
geom_text(show.legend = FALSE, size = ifelse(selected_props()$word %in% highlighted_properties(), 7,
ifelse(is.null(highlighted_properties()), 3, 2.8)),
fontface = ifelse(selected_props()$word %in% highlighted_properties(), 'bold', 'plain')) +
geom_point(alpha = 0) + scale_colour_manual(values = colours, drop = FALSE) + theme_bw() +
guides(color = guide_legend(title = 'Main&amp;lt;br&amp;gt;modality', override.aes = list(size = 7, alpha = 1))) +
ggtitle( paste0('Properties', ' (showing ', nrow(selected_props()), ' out of ', nrow(props), ')') ) +
labs(x = 'Varimax-rotated Principal Component 1', y = 'Varimax-rotated Principal Component 2') +
theme( plot.background = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), panel.border = element_blank(),
axis.line = element_line(color = 'black'), plot.title = element_text(size = 17, hjust = .5, margin = margin(3,3,7,3)),
axis.title.x = element_text(colour = 'black', size = 12, margin = margin(10,10,2,10)),
axis.title.y = element_text(colour = 'black', size = 12, margin = margin(10,10,10,5)),
axis.text.x = element_text(size = 8), axis.text.y = element_text(size = 8),
legend.background = element_rect(size = 2), legend.position = 'right',
legend.title = element_blank(), legend.text = element_text(size = 15))
})
```
&lt;/code>&lt;/pre>
&lt;p>The only instance in which I drew on JavaScript code outside R packages was to enable tooltips beyond the packages’ limits—for instance, in the sidebar. This JavaScript feature is created at the top of the script, in the head area.&lt;/p>
&lt;pre>&lt;code>&amp;lt;!-- Javascript function to enable a hovering tooltip --&amp;gt;
&amp;lt;script&amp;gt;
$(document).ready(function(){
$('[data-toggle=&amp;quot;tooltip1&amp;quot;]').tooltip();
});
&amp;lt;/script&amp;gt;
&lt;/code>&lt;/pre>
&lt;/li>
&lt;li>
&lt;p>In the sidebar, I added a reactive mean for each variable, complementing the range selector.&lt;/p>
&lt;pre>&lt;code>reactive(cat(paste0('Mean = ',
sprintf(&amp;quot;%.2f&amp;quot;, round(mean(selected_words()$Exclusivity),2)))))
&lt;/code>&lt;/pre>
&lt;/li>
&lt;/ul>
&lt;h2 id="static-version-published-on-rpubs">Static version published on RPubs&lt;/h2>
&lt;p>A reduced,
&lt;a href="https://rpubs.com/pcbernabeu/Dutch-modality-exclusivity-norms">&lt;em>static&lt;/em> version&lt;/a> was also created to increase the availability of the content. Removing some reactivity features allows the dashboard to be published as a standard website (i.e., on a personal website, on
&lt;a href="https://rpubs.com/">RPubs&lt;/a>, etc.), without the need for a back-end Shiny server. Note that this type of website is dubbed 'static', but it can retain multiple interactive features thanks to Javascript-based tools under the hood, allowed by R packages such as &lt;code>leaflet&lt;/code> for maps, &lt;code>DT&lt;/code> for tables, &lt;code>plotly&lt;/code> for plots, etc.&lt;/p>
&lt;p>To create the Flexdashboard-only version departing from the Flexdashboard-Shiny version, I deleted &lt;code>runtime: shiny&lt;/code> from the YAML header, and disabled Shiny reactive inputs and objects, as below.&lt;/p>
&lt;pre>&lt;code>```{r}
# Number of words selected on sidebar
# reactive(cat(paste0('Words selected below: ', nrow(selected_props()))))
```
&lt;/code>&lt;/pre>
&lt;h2 id="reference">Reference&lt;/h2>
&lt;p>Bernabeu, P. (2018). Dutch modality exclusivity norms for 336 properties and 411 concepts [Web application]. Retrieved from &lt;a href="https://pablobernabeu.shinyapps.io/Dutch-Modality-Exclusivity-Norms">https://pablobernabeu.shinyapps.io/Dutch-Modality-Exclusivity-Norms&lt;/a>&lt;/p></description></item><item><title>Modality switch effects emerge early and increase throughout conceptual processing: Evidence from ERPs</title><link>https://pablobernabeu.github.io/publication/bernabeu-etal-2017/</link><pubDate>Sat, 01 Jul 2017 00:00:00 +0000</pubDate><guid>https://pablobernabeu.github.io/publication/bernabeu-etal-2017/</guid><description>&lt;h3 id="study-at-a-glance">Study at a glance&lt;/h3>
&lt;div class="mermaid">
graph TD
A["46 participants verify property-concept word relations"] --> B["Modality of consecutive trials manipulated"]
B --> C["Auditory-to-visual switch"]
B --> D["Haptic-to-visual switch"]
B --> E["Visual-to-visual no-switch"]
C --> F["ERPs time-locked to first word onset"]
D --> F
E --> F
F --> G["Switch effect: more negative amplitudes for switches"]
G --> H["Significant in four windows from 160 to 750 ms, stronger posteriorly and after 350 ms"]
&lt;/div>
&lt;p>&lt;em>Schematic overview; see the text for details.&lt;/em>&lt;/p>
&lt;h3 id="reference">Reference&lt;/h3>
&lt;p>Bernabeu, P., Willems, R. M., &amp;amp; Louwerse, M. M. (2017). Modality switch effects emerge early and increase throughout conceptual processing: Evidence from ERPs. In G. Gunzelmann, A. Howes, T. Tenbrink, &amp;amp; E. J. Davelaar (Eds.), &lt;em>Proceedings of the 39th Annual Conference of the Cognitive Science Society&lt;/em> (pp. 1629-1634). Austin, TX: Cognitive Science Society. &lt;a href="https://doi.org/10.31234/osf.io/a5pcz">https://doi.org/10.31234/osf.io/a5pcz&lt;/a>&lt;/p>
&lt;h3 id="related-podcasts">Related podcasts&lt;/h3>
&lt;p>&lt;i class="fa-solid fa-wand-magic-sparkles" style='color:darkgrey;'>&lt;/i> &lt;span style='color:darkgrey; font-style:italic; font-size:85%;'>Created using NotebookLM, with all the benefits and blind spots of human editing.&lt;/span>&lt;/p>
&lt;iframe allow="autoplay *; encrypted-media *; fullscreen *; clipboard-write" frameborder="0" height="175" style="width:100%;max-width:720px;overflow:hidden;border-radius:10px;" sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation-by-user-activation" src="https://embed.podcasts.apple.com/us/podcast/modality-switch-effects-the-brain-friction-of/id1837010092?i=1000749632781">&lt;/iframe>
&lt;iframe allow="autoplay *; encrypted-media *; fullscreen *; clipboard-write" frameborder="0" height="175" style="width:100%;max-width:720px;overflow:hidden;border-radius:10px;" sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation-by-user-activation" src="https://embed.podcasts.apple.com/us/podcast/behind-the-curtains-methods-used-to-investigate/id1837010092?i=1000725594999">&lt;/iframe>
&lt;h3 id="conference-poster-with-additional-analyses-nbspa-hrefhttpsosfio97unmfilesdj52ni-classfas-fa-external-link-altia">Conference poster with additional analyses  &lt;a href='https://osf.io/97unm/files/dj52n'>&lt;i class="fas fa-external-link-alt">&lt;/i>&lt;/a>&lt;/h3>
&lt;div class="document-viewer-container" style="height: 470px; min-height: 400px;">
&lt;iframe src="https://cdn.jsdelivr.net/gh/pablobernabeu/Modality-switch-effects-emerge-early-and-increase-throughout-conceptual-processing@bae8be8180e719dbb1214ffd3ce90643d1cb9144/Poster%20-%20Bernabeu%20et%20al.,%20Modality%20switch%20effects%20emerge%20early%20and%20increase%20throughout%20conceptual%20processing.pdf" width="100%" height="100%" style="border: none" title="Document Viewer" loading="lazy">
&lt;p>Your browser does not support embedded PDFs. &lt;a href="https://cdn.jsdelivr.net/gh/pablobernabeu/Modality-switch-effects-emerge-early-and-increase-throughout-conceptual-processing@bae8be8180e719dbb1214ffd3ce90643d1cb9144/Poster%20-%20Bernabeu%20et%20al.,%20Modality%20switch%20effects%20emerge%20early%20and%20increase%20throughout%20conceptual%20processing.pdf" target="_blank">Download the PDF&lt;/a> instead.&lt;/p>
&lt;/iframe>
&lt;/div></description></item><item><title>Modality switch effects emerge early and increase throughout conceptual processing</title><link>https://pablobernabeu.github.io/applications-and-dashboards/bernabeu-etal-2017-modalityswitch/</link><pubDate>Sun, 01 Jan 2017 00:00:00 +0000</pubDate><guid>https://pablobernabeu.github.io/applications-and-dashboards/bernabeu-etal-2017-modalityswitch/</guid><description>&lt;h3 id="how-it-works">How it works&lt;/h3>
&lt;p>&lt;em>Schematic overview; see the text for details.&lt;/em>&lt;/p>
&lt;div class="mermaid">
graph TD
A["EEG-ERP data from word comprehension experiment"] --> B["ERP plots spanning 800 ms of word processing"]
B --> C["Groups of participants"]
C --> D["Individual participants"]
D --> E["Brain areas"]
E --> F["Electrodes"]
B --> G["Download HD plots, view 95% confidence intervals"]
&lt;/div>
&lt;a href='https://pablobernabeu.shinyapps.io/ERP-waveform-visualization_CMS-experiment/'>
&lt;button style = "background-color: white; color: black; border: 2px solid #4CAF50; border-radius: 12px;">
&lt;h3 style = "margin-top: 7px !important; margin-left: 9px !important; margin-right: 9px !important;">
&lt;span style="color:#DBE6DA;">&lt;/span> Web application &lt;/h3>&lt;/button>&lt;/a> &amp;nbsp;
&lt;br>
&lt;br>
&lt;p>&lt;strong>Content&lt;/strong>&lt;/p>
&lt;p>The data are from a psychology experiment on the comprehension of words, in which electroencephalographic (EEG) responses were measured. The data are presented in plots spanning 800 milliseconds (the duration of word processing). The aim of this Shiny app is to facilitate the exploration of the data by researchers and the public. Users can delve into the different sections of the data. In a hierarchical order, these sections are groups of participants, individual participants, brain areas, and electrodes.&lt;/p>
&lt;p>&lt;strong>Shiny apps in science&lt;/strong>&lt;/p>
&lt;p>By creating this app, I tried to reach beyond the scope of current &lt;em>open science&lt;/em>, which is often confined to files shared on data repositories. I believe that Shiny apps will become general practice in science within a few years (
&lt;a href="http://www.research.lancs.ac.uk/portal/en/activities/presenting-data-interactively-online-using-r-shiny%28c9ce06ac-987e-4141-9121-016f6ee6d16b%29.html">see blog post or slides for more information&lt;/a>).&lt;/p>
&lt;p>&lt;strong>Technical details&lt;/strong>&lt;/p>
&lt;p>I used tabs on the upper area of the application page to avoid cramming the side bar with widgets. I adjusted the appearance of these tabs, and by means of 'reactivity' conditions, modified the inputs in the side bar depending on the active tab.&lt;/p>
&lt;pre>&lt;code>mainPanel(
tags$style(HTML('
.tabbable &amp;gt; .nav &amp;gt; li &amp;gt; a {background-color:white; color:#3E454E}
.tabbable &amp;gt; .nav &amp;gt; li &amp;gt; a:hover {background-color:#002555; color:white}
.tabbable &amp;gt; .nav &amp;gt; li[class=active] &amp;gt; a {background-color:#ECF4FF; color:black}
.tabbable &amp;gt; .nav &amp;gt; li[class=active] &amp;gt; a:hover {background-color:#E7F1FF; color:black}
')),
tabsetPanel(id='tabvals',
tabPanel(value=1, h4(strong('Group &amp;amp; Electrode')), br(), plotOutput('plot_GroupAndElectrode'),
h5(a(strong('See plots with 95% Confidence Intervals'), href='https://osf.io/2tpxn/',
target='_blank'), style='text-decoration: underline;'),
downloadButton('downloadPlot.1', 'Download HD plot'), br(), br(),
# EEG montage
img(src='https://preview.ibb.co/n7qiYR/EEG_montage.png', height=500, width=1000)),
tabPanel(value=2, h4(strong('Participant &amp;amp; Area')), br(), plotOutput('plot_ParticipantAndLocation'),
h5(a(strong('See plots with 95% Confidence Intervals'), href='https://osf.io/86ch9/',
target='_blank'), style='text-decoration: underline;'),
downloadButton('downloadPlot.2', 'Download HD plot'), br(), br(),
# EEG montage
img(src='https://preview.ibb.co/n7qiYR/EEG_montage.png', height=500, width=1000)),
tabPanel(value=3, h4(strong('Participant &amp;amp; Electrode')), br(), plotOutput('plot_ParticipantAndElectrode'),
br(), downloadButton('downloadPlot.3', 'Download HD plot'), br(), br(),
# EEG montage
img(src='https://preview.ibb.co/n7qiYR/EEG_montage.png', height=500, width=1000)),
tabPanel(value=4, h4(strong('OLD Group &amp;amp; Electrode')), br(), plotOutput('plot_OLDGroupAndElectrode'),
h5(a(strong('See plots with 95% Confidence Intervals'), href='https://osf.io/dvs2z/',
target='_blank'), style='text-decoration: underline;'),
downloadButton('downloadPlot.4', 'Download HD plot'), br(), br(),
# EEG montage
img(src='https://preview.ibb.co/n7qiYR/EEG_montage.png', height=500, width=1000))
),
&lt;/code>&lt;/pre>
&lt;p>The data set was fairly large, considering the fact that it's hosted with the free plan. In order to lighten the processing, I split the data into various files, reducing the total size. Furthermore, I outsourced a particularly heavy set of plots (those with Confidence Intervals) to PDF files, to which I linked in the app.&lt;/p>
&lt;pre>&lt;code>h5(a(strong('See plots with 95% Confidence Intervals'), href='https://osf.io/dvs2z/',
target='_blank'), style='text-decoration: underline;'),
&lt;/code>&lt;/pre>
&lt;p>I also used web links to the published paper and raw data, as well as to the &lt;em>server&lt;/em> and &lt;em>ui&lt;/em> scripts. These files, along with the data, are publicly available
&lt;a href="https://osf.io/97unm/">in this repository&lt;/a>; they may be accessed within the &amp;quot;Files&amp;quot; section, by opening the folders &amp;quot;ERPs&amp;quot; -&amp;gt; &amp;quot;Analyses of ERPs averaged across trials&amp;quot; -&amp;gt; &amp;quot;Shiny app&amp;quot;.&lt;/p>
&lt;p>Another feature I added was the download button.&lt;/p>
&lt;pre>&lt;code># From server.R script
spec_title = paste0('ERP waveforms for ', input$var.Group, ' Group, Electrode ', input$var.Electrodes.1, ' (negative values upward; time windows displayed)')
plot_GroupAndElectrode = ggplot(df2, aes(x=time, y=-microvolts, color=condition)) +
geom_rect(xmin=160, xmax=216, ymin=7.5, ymax=-8, color = 'grey75', fill='black', alpha=0, linetype='longdash') +
geom_rect(xmin=270, xmax=370, ymin=7.5, ymax=-8, color = 'grey75', fill='black', alpha=0, linetype='longdash') +
geom_rect(xmin=350, xmax=550, ymin=8, ymax=-7.5, color = 'grey75', fill='black', alpha=0, linetype='longdash') +
geom_rect(xmin=500, xmax=750, ymin=7.5, ymax=-8, color = 'grey75', fill='black', alpha=0, linetype='longdash') +
geom_line(size=1, alpha = 1) + scale_linetype_manual(values=colours) +
scale_y_continuous(limits=c(-8.38, 8.3), breaks=seq(-8,8,by=1), expand = c(0,0.1)) +
scale_x_continuous(limits=c(-208,808),breaks=seq(-200,800,by=100), expand = c(0.005,0), labels= c('-200','-100 ms','0','100 ms','200','300 ms','400','500 ms','600','700 ms','800')) +
ggtitle(spec_title) + theme_bw() + geom_vline(xintercept=0) +
annotate(geom='segment', y=seq(-8,8,1), yend=seq(-8,8,1), x=-4, xend=8, color='black') +
annotate(geom='segment', y=-8.2, yend=-8.38, x=seq(-200,800,100), xend=seq(-200,800,100), color='black') +
geom_segment(x = -200, y = 0, xend = 800, yend = 0, size=0.5, color='black') +
theme(legend.position = c(0.100, 0.150), legend.background = element_rect(fill='#EEEEEE', size=0),
axis.title=element_blank(), legend.key.width = unit(1.2,'cm'), legend.text=element_text(size=17),
legend.title = element_text(size=17, face='bold'), plot.title= element_text(size=20, hjust = 0.5, vjust=2),
axis.text.y = element_blank(), axis.text.x = element_text(size = 14, vjust= 2.12, face='bold', color = 'grey32', family='sans'),
axis.ticks=element_blank(), panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), plot.margin = unit(c(0.1,0.1,0,0), 'cm')) +
annotate('segment', x=160, xend=216, y=-8, yend=-8, colour = 'grey75', size = 1.5) +
annotate('segment', x=270, xend=370, y=-8, yend=-8, colour = 'grey75', size = 1.5) +
annotate('segment', x=350, xend=550, y=-7.5, yend=-7.5, colour = 'grey75', size = 1.5) +
annotate('segment', x=500, xend=750, y=-8, yend=-8, colour = 'grey75', size = 1.5) +
scale_fill_manual(name = 'Context / Target trial', values=colours) +
scale_color_manual(name = 'Context / Target trial', values=colours) +
guides(linetype=guide_legend(override.aes = list(size=1.2))) +
guides(color=guide_legend(override.aes = list(size=2.5))) +
# Print y axis labels within plot area:
annotate('text', label = expression(bold('\u2013' * '3 ' * '\u03bc' * 'V')), x = -29, y = 3, size = 4.5, color = 'grey32', family='sans') +
annotate('text', label = expression(bold('+3 ' * '\u03bc' * 'V')), x = -29, y = -3, size = 4.5, color = 'grey32', family='sans') +
annotate('text', label = expression(bold('\u2013' * '6 ' * '\u03bc' * 'V')), x = -29, y = 6, size = 4.5, color = 'grey32', family='sans')
print(plot_GroupAndElectrode)
output$downloadPlot.1 &amp;lt;- downloadHandler(
filename &amp;lt;- function(file){
paste0(input$var.Group, ' group, electrode ', input$var.Electrodes.1, ', ', Sys.Date(), '.png')},
content &amp;lt;- function(file){
png(file, units='in', width=13, height=5, res=900)
print(plot_GroupAndElectrode)
dev.off()},
contentType = 'image/png')
} )
&lt;/code>&lt;/pre>
&lt;pre>&lt;code># From ui.R script
downloadButton('downloadPlot.1', 'Download HD plot')
&lt;/code>&lt;/pre>
&lt;p>&lt;strong>&lt;em>Rising to the challenge&lt;/em>&lt;/strong>&lt;/p>
&lt;p>My experience with R Shiny has been so good I've been
&lt;a href="https://pablobernabeu.github.io/2017/the-case-for-data-dashboards-first-steps-in-r-shiny/">sharing it&lt;/a>. Yet, on my first crawling days, I spent an eternity stuck with this elephant in my room: &amp;quot;μ&amp;quot;. This &lt;em>μ&lt;/em> letter (micro-souvenir from hell, as I later knew it), was part of the labels of my plots. All I knew was that I could not deploy the app online, even while I could perfectly launch it locally in my laptop. So, I wondered what use it was to deploy locally if I couldn't publish the app?! Eventually, I read about UTF-8 encoding in one forum. Bless them forums. All I had to do was use &amp;quot;Âμ&amp;quot; instead of the single &amp;quot;μ&amp;quot;. A better option I found later was: &lt;code>expression(&amp;quot;\u03bc&amp;quot;)&lt;/code>.&lt;/p>
&lt;p>Beyond encoding issues, I had a tough time embedding images. You know, the 'www' folder... To be honest, I still haven't handled the 'www' way--but where there's a will, there's a way. I managed to include my images by uploading them to a website and then entering their URL in &amp;quot;img(src&amp;quot;, avoiding the use of folder paths.&lt;/p>
&lt;pre>&lt;code>img(src=&amp;quot;https://preview.ibb.co/n7qiYR/EEG_montage.png 1&amp;quot;, height=500, width=1000)
&lt;/code>&lt;/pre>
&lt;p>Long after I had built the app, I added another image--the &lt;em>favicon&lt;/em> (the little icon on the browser tab).&lt;/p>
&lt;pre>&lt;code>tags$head(tags$link(rel=&amp;quot;shortcut icon&amp;quot;, href=&amp;quot;https://image.ibb.co/fXUwzb/favic.png&amp;quot;)), # web favicon
&lt;/code>&lt;/pre>
&lt;h3 id="reference">Reference&lt;/h3>
&lt;p>Bernabeu, P., Willems, R. M., &amp;amp; Louwerse, M. M. (2017). Modality switch effects emerge early and increase throughout conceptual processing: Evidence from ERPs [Web application]. Retrieved from &lt;a href="https://pablobernabeu.shinyapps.io/ERP-waveform-visualization_CMS-experiment">https://pablobernabeu.shinyapps.io/ERP-waveform-visualization_CMS-experiment&lt;/a>&lt;/p></description></item><item><title>Language evolution: Current status and future directions</title><link>https://pablobernabeu.github.io/publication/bernabeu_vogt2015/</link><pubDate>Thu, 01 Jan 2015 00:00:00 +0000</pubDate><guid>https://pablobernabeu.github.io/publication/bernabeu_vogt2015/</guid><description>&lt;h3 id="study-at-a-glance">Study at a glance&lt;/h3>
&lt;div class="mermaid">
graph TD
A["Adapted prior experiment: participants act out events"] --> B["Perceptual features of events"]
A --> C["Added variable: communication mode"]
C --> D["Body-based communication (gestures)"]
C --> E["Disembodied communication (symbol matching)"]
B --> F["Resulting grammatical orders / preferences"]
D --> F
E --> F
F --> G["Greater effect of embodiment on grammatical preferences"]
&lt;/div>
&lt;p>&lt;em>Schematic overview; see the text for details.&lt;/em>&lt;/p>
&lt;h3 id="reference">Reference&lt;/h3>
&lt;p>Bernabeu, P., &amp;amp; Vogt, P. (2015). Language evolution: Current status and future directions. &lt;em>Tenth Language at the University of Essex (LangUE) Postgraduate Conference&lt;/em>. &lt;a href="https://researchgate.net/publication/280858062/">https://researchgate.net/publication/280858062/&lt;/a>&lt;/p></description></item></channel></rss>