{"id":5,"date":"2024-04-04T07:52:19","date_gmt":"2024-04-04T04:52:19","guid":{"rendered":"https:\/\/sisu.ut.ee\/multilingualwritingprocesses\/specs\/"},"modified":"2025-01-08T16:18:36","modified_gmt":"2025-01-08T14:18:36","slug":"specs","status":"publish","type":"page","link":"https:\/\/sisu.ut.ee\/multilingualwritingprocesses\/specs\/","title":{"rendered":"Technical data for creating the dygraphs"},"content":{"rendered":"<figure data-wp-context='{\"imageId\":\"69fff21118067\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"69fff21118067\" class=\"wp-block-image alignright size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"865\" height=\"703\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/sisu.ut.ee\/wp-content\/uploads\/sites\/548\/source_use_categories.jpg\" alt=\"Categories used for classifying source use\" class=\"wp-image-28\" title=\"source_use_categories.jpg\" srcset=\"https:\/\/sisu.ut.ee\/wp-content\/uploads\/sites\/548\/source_use_categories.jpg 865w, https:\/\/sisu.ut.ee\/wp-content\/uploads\/sites\/548\/source_use_categories-300x244.jpg 300w, https:\/\/sisu.ut.ee\/wp-content\/uploads\/sites\/548\/source_use_categories-768x624.jpg 768w\" sizes=\"auto, (max-width: 865px) 100vw, 865px\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><figcaption class=\"wp-element-caption\">Figure 1. Categories for problem solving activity.<br>   L1 = language of highest competence <br>   LF = lingua franca <br>   TL = target language<\/figcaption><\/figure>\n\n\n\n<p>The dygraphs on this page have been created with <a title=\"\" data-url=\"https:\/\/www.r-project.org\/\" href=\"https:\/\/www.r-project.org\/\" target=\"_blank\" rel=\"noopener\">R<\/a> (R Core Team 2021), using the <a title=\"\" data-url=\"https:\/\/dygraphs.com\/\" href=\"https:\/\/dygraphs.com\/\" target=\"_blank\" rel=\"noopener\">dygraphs<\/a> package (<span lang=\"EN-US\">Vanderkam, Allaire, Owen, Gromer, Thieurmel<i> <\/i>2018<\/span>). To create the dygraph, you need an Excel table where in Column A you have a timeline of the writing process by each 100 milliseconds,\u00a0and in Column B the category of the source used at that time as a numeric value. <\/p>\n\n\n\n<p>From Inputlog data, you get the timestamp of the focus\/source switch, which needs to be densified with data from all the moments between the switches; this can be done in MS Excel, by creating one table with the switch timestamps (in seconds) in one column, and the source category in the other, and a second table: start at 0, fill series in column with a step value of 0.1 and stop value of the last switch (rounded to one space after the comma). These tables can then be merged (left join; tutorial <a title=\"\" data-url=\"https:\/\/trumpexcel.com\/merge-tables\/\" href=\"https:\/\/trumpexcel.com\/merge-tables\/\" target=\"_blank\" rel=\"noopener\">here<\/a>) and the missing category values filled in (see <a title=\"\" data-url=\"https:\/\/www.extendoffice.com\/documents\/excel\/3974-excel-repeat-a-value-until-new-value-is-seen.html\" href=\"https:\/\/www.extendoffice.com\/documents\/excel\/3974-excel-repeat-a-value-until-new-value-is-seen.html\" target=\"_blank\" rel=\"noopener\">here<\/a> how).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating graphs with R<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Required packages<\/h3>\n\n\n\n<p>Requirement: <strong>dygraph<\/strong><\/p>\n\n\n\n<p>Other necessary packages: <strong>readxl<\/strong>, <strong>xts<\/strong>, <strong>magrittr<\/strong>.<\/p>\n\n\n\n<p>For adding a checklist that allows to select which participants to display, a plugin is needed:<strong> <a title=\"\" data-url=\"https:\/\/github.com\/rstudio\/dygraphs\/commit\/a4e3553005a021fbf597b97ed5b9170f37bb611c#diff-6bfde7c45389aab3b61eae6473747c4bcc4f4fa814fc4c17c51ef6a3bb5969eb\" href=\"https:\/\/github.com\/rstudio\/dygraphs\/commit\/a4e3553005a021fbf597b97ed5b9170f37bb611c#diff-6bfde7c45389aab3b61eae6473747c4bcc4f4fa814fc4c17c51ef6a3bb5969eb\" target=\"_blank\" rel=\"noopener\">hide.js<\/a>\u00a0<\/strong><\/p>\n\n\n\n<p><strong>To activate hide plugin (each time you run R after closing it):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dyHide &lt;-function(dygraph) {\ndyPlugin(\ndygraph = dygraph,\nname = \"Hide\",\npath = system.file(\"plugins\/hide.js\", package = \"dygraphs\")\n)\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">The code for creating individual graphs:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>dygraph(<b>dataset name<\/b>, main = \"<b>graph title<\/b>\") %&gt;% \u00a0<br>dyAxis(\"y\", label = \"<b>Label for Column 1 in dataset<\/b>\", valueRange = c(-1, 22)) %&gt;% \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br><span style=\"color: #808080;\">\u00a0#Complexity score value range<\/span><span style=\"color: #a9a9a9;\">, replace values if necessary<\/span><br>dyAxis(\"x\", drawGrid=F) %&gt;%<br>dyAxis(\"y\", drawGrid=F) %&gt;%<br>dyLimit(-1, \"<b>range1<\/b>\", labelLoc=\"right\", color=\"black\") %&gt;%\u00a0<br><span style=\"color: #a9a9a9;\">#range1: -1 to 0, in our graph \"technical area\"<\/span><br>dyShading(-1, 0, color=\"grey\", axis=\"y\") %&gt;%<br>dyShading(0, 5, color=\"#ccff99\", axis=\"y\") %&gt;%<br>dyLimit(0, \"<b>range2<\/b>\", strokePattern = \"solid\", labelLoc=\"right\", color=\"grey\") %&gt;%<br><span style=\"color: #a9a9a9;\">#range2: 0 to 5, in our graph \"TL\" or target language activity <\/span><br>dyLimit(5, \"<b>range3<\/b>\", labelLoc=\"right\", color=\"grey\") %&gt;%\u00a0<br><span style=\"color: #a9a9a9;\">#range3: 5 to 10, in our graph \"L1-TL\" or activity between L1 and the target language <\/span><br>dyLimit(10, \"<b>range4<\/b>\", labelLoc=\"right\", color=\"grey\") %&gt;%\u00a0<br><span style=\"color: #a9a9a9;\">#range4: 10 to 15, in our graph \"LF-TL\"<\/span> <span style=\"color: #a9a9a9;\">or activity between a <em>lingua franca<\/em> and the target language <\/span><br>dyLimit(15, \"<b>range5<\/b>\", labelLoc=\"right\", color=\"grey\") %&gt;%\u00a0<br><span style=\"color: #a9a9a9;\">#range 5: 15 to 20,<\/span> <span style=\"color: #a9a9a9;\">in our graph \"L1-LF\"<\/span> <span style=\"color: #a9a9a9;\">or activity between L1 and a <em>lingua franca<\/em> <\/span><br>dyShading(5, 10, color=\"#ffffcc\", axis=\"y\") %&gt;%<br>dyShading(10, 15, color=\"#ffebcc\", axis=\"y\") %&gt;%<br>dyShading(15, 20, color=\"#ffcccc\", axis=\"y\") %&gt;%<br>dyOptions(drawPoints = TRUE) %&gt;%<br>dyOptions(fillGraph = TRUE) %&gt;%<br>dyRangeSelector %&gt;%<br><span lang=\"EN-US\"><span style=\"line-height: 107%;\">dyLegend(width = 200)<\/span><\/span><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">The code for creating group graph:<\/h3>\n\n\n\n<p>For combining graphs you need to have all participants on the same Excel sheet, with their IDs as column names. For all that have a shorter writing process than the participant who wrote the longest, fill in NA values. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dygraph(<strong>dataset_name<\/strong>, main = \"<strong>graph title<\/strong>\") %&gt;%\ndyAxis(\"y\", label = \"<b>Label for Column 1 in dataset<\/b>\", valueRange = c(-1, 22)) %&gt;%\n<span style=\"color: #808080;\">#Complexity score value range<\/span><span style=\"color: #a9a9a9;\">, replace values if necessary<\/span>\ndyAxis(\"x\", drawGrid=F) %&gt;%\ndyAxis(\"y\", drawGrid=F) %&gt;%\ndyLimit(-1, \"<strong>range 1<\/strong>\", labelLoc=\"right\", color=\"black\") %&gt;%\n<span style=\"color: #a9a9a9;\">#range1: -1 to 0, in our graph \"technical area\"<\/span>\ndySeries (\"<strong>column name<\/strong>\", label = \"<strong>display label<\/strong>\", color = \"black\") %&gt;%\n<span style=\"color: #a9a9a9;\">#series are individual columns, color refers to stroke line. Add as many as you need.<\/span> \u00a0\u00a0\u00a0\ndyGroup (c(\"<strong>column 1<\/strong>\", \"<strong>column 2<\/strong>\"), label = \"<strong>display label<\/strong>\", color = c(\"#73006b\", \"#c2000b\")) %&gt;%\n<span style=\"color: #a9a9a9;\">#Groups include several series, i.e. columns. Each series needs a color assigned to it. <\/span>\ndyShading(-1, 0, color=\"grey\", axis=\"y\") %&gt;%\ndyShading(0, 6, color=\"#ccff99\", axis=\"y\") %&gt;%\ndyLimit(0, \"<strong>range 2<\/strong>\", strokePattern = \"solid\", labelLoc=\"right\", color=\"grey\") %&gt;%\n<span style=\"color: #a9a9a9;\">#range2: 0 to 5, in our graph \"TL\" or target language activity <\/span>\ndyLimit(6, \"<strong>range 3<\/strong>\", labelLoc=\"right\", color=\"grey\") %&gt;%\n<span style=\"color: #a9a9a9;\">#range3: 5 to 10, in our graph \"L1-TL\" or activity between L1 and the target language <\/span>\ndyLimit(12, \"<strong>range 4<\/strong>\", labelLoc=\"right\", color=\"grey\") %&gt;%\n<span style=\"color: #a9a9a9;\">#range4: 10 to 15, in our graph \"LF-TL\"<\/span> <span style=\"color: #a9a9a9;\">or activity between a <em>lingua franca<\/em> and the target language <\/span>\ndyLimit(18, \"<strong>range5<\/strong>\", labelLoc=\"right\", color=\"grey\") %&gt;%\u00a0\u00a0 \u00a0\n<span style=\"color: #a9a9a9;\">#range 5: 15 to 20,<\/span> <span style=\"color: #a9a9a9;\">in our graph \"L1-LF\"<\/span> <span style=\"color: #a9a9a9;\">or activity between L1 and a <em>lingua franca<\/em><\/span>\ndyShading(6, 12, color=\"#ffffcc\", axis=\"y\") %&gt;%\ndyShading(12, 18, color=\"#ffebcc\", axis=\"y\") %&gt;%\ndyShading(18, 22, color=\"#ffcccc\", axis=\"y\") %&gt;%\ndyOptions(fillGraph = TRUE) %&gt;%\ndyRangeSelector %&gt;%\ndyHide()\ndyLegend(width = 200)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The dygraphs on this page have been created with R (R Core Team 2021), using the dygraphs package (Vanderkam, Allaire, Owen, Gromer, Thieurmel 2018). To create the dygraph, you need an Excel table where in Column A you have a &#8230;<\/p>\n","protected":false},"author":259,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"class_list":["post-5","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/sisu.ut.ee\/multilingualwritingprocesses\/wp-json\/wp\/v2\/pages\/5","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sisu.ut.ee\/multilingualwritingprocesses\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sisu.ut.ee\/multilingualwritingprocesses\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sisu.ut.ee\/multilingualwritingprocesses\/wp-json\/wp\/v2\/users\/259"}],"replies":[{"embeddable":true,"href":"https:\/\/sisu.ut.ee\/multilingualwritingprocesses\/wp-json\/wp\/v2\/comments?post=5"}],"version-history":[{"count":14,"href":"https:\/\/sisu.ut.ee\/multilingualwritingprocesses\/wp-json\/wp\/v2\/pages\/5\/revisions"}],"predecessor-version":[{"id":177,"href":"https:\/\/sisu.ut.ee\/multilingualwritingprocesses\/wp-json\/wp\/v2\/pages\/5\/revisions\/177"}],"wp:attachment":[{"href":"https:\/\/sisu.ut.ee\/multilingualwritingprocesses\/wp-json\/wp\/v2\/media?parent=5"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}