Created
February 10, 2018 15:19
-
-
Save kenwebb/cc80d3bee97f2f4f2d17307674a358a0 to your computer and use it in GitHub Desktop.
R tidyverse - workflows and functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Sat Feb 10 2018 10:18:50 GMT-0500 (EST)--> | |
<XholonWorkbook> | |
<Notes><![CDATA[ | |
Xholon | |
------ | |
Title: R tidyverse - workflows and functions | |
Description: | |
Url: http://www.primordion.com/Xholon/gwt/ | |
InternalName: | |
Keywords: | |
My Notes | |
-------- | |
February 10, 2018 | |
Think about the functions and workflows using in R tidyverse. | |
The tidyverse offers a range of functions/operations that can be organized into pipelines (workflows). | |
dplyr (R package) | |
----- | |
mutate | |
select | |
filter | |
summarize | |
arrange | |
- A function searches for input data, in the following order: | |
1. text enclosed by the XML start and end tag (the function would need to be an Attribute_String) | |
2. the data specified by the XML "data" attribute, which might be: | |
- an XPath exression that references another node in the Xholon subtree | |
- a file name | |
- a URL | |
- an SQL statement | |
- etc. | |
3. the Xholon subtree contained within its previous sibling | |
References | |
---------- | |
(1) http://tidyverse.org/ | |
(2) http://dplyr.tidyverse.org/ | |
dplyr is a grammar of data manipulation, providing a consistent set of verbs that help you solve the most common data manipulation challenges: | |
mutate() adds new variables that are functions of existing variables | |
select() picks variables based on their names. | |
filter() picks cases based on their values. | |
summarise() reduces multiple values down to a single summary. | |
arrange() changes the ordering of the rows. | |
These all combine naturally with group_by() which allows you to perform any operation “by group”. | |
(3) http://purrr.tidyverse.org/ | |
(4) http://tibble.tidyverse.org/ | |
(5) http://ggplot2.tidyverse.org/ | |
(6) http://tidyr.tidyverse.org/ | |
(7) http://readr.tidyverse.org/ | |
(8) https://www.tidyverse.org/packages/ | |
(9) https://www.tidytextmining.com/ | |
(10) https://cran.r-project.org/web/packages/broom/index.html | |
]]></Notes> | |
<_-.XholonClass> | |
<PhysicalSystem/> | |
<!-- a universal set, such as all integers, or more practically some small sequence or collection of integers --> | |
<UniversalSet/> | |
<!-- tidyverse functions --> | |
<tidyverseFunction> | |
<dplyrFunc> | |
<mutate/> | |
<select/> | |
<filter/> | |
<summarize/> | |
<arrange/> | |
</dplyrFunc> | |
</tidyverseFunction> | |
</_-.XholonClass> | |
<xholonClassDetails> | |
<!--<Block> | |
<port name="height" connector="Height"/> | |
</Block>--> | |
</xholonClassDetails> | |
<PhysicalSystem> | |
<!-- a dataset; the "rows" should be tuples/tibbles --> | |
<UniversalSet roleName="U"> | |
<!-- integers from 1 to 20 --> | |
<Attribute_int>1</Attribute_int> | |
<Attribute_int>2</Attribute_int> | |
<Attribute_int>3</Attribute_int> | |
<Attribute_int>4</Attribute_int> | |
<Attribute_int>5</Attribute_int> | |
<Attribute_int>6</Attribute_int> | |
<Attribute_int>7</Attribute_int> | |
<Attribute_int>8</Attribute_int> | |
<Attribute_int>9</Attribute_int> | |
<Attribute_int>10</Attribute_int> | |
<Attribute_int>11</Attribute_int> | |
<Attribute_int>12</Attribute_int> | |
<Attribute_int>13</Attribute_int> | |
<Attribute_int>14</Attribute_int> | |
<Attribute_int>15</Attribute_int> | |
<Attribute_int>16</Attribute_int> | |
<Attribute_int>17</Attribute_int> | |
<Attribute_int>18</Attribute_int> | |
<Attribute_int>19</Attribute_int> | |
<Attribute_int>20</Attribute_int> | |
</UniversalSet> | |
<!-- ex: filter(starwars, species == "Human") --> | |
<filter>Attribute_int == 1</filter> | |
<filter data="" pred="Attribute_int == 1"/> | |
<filter data="../UniversalSet" pred="Attribute_int > 10"/> | |
</PhysicalSystem> | |
<filterbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
var data = me.text(); | |
if (!data) { | |
data = me["data"]; | |
} | |
if (!data) { | |
data = me.prev(); | |
} | |
me.println("\n" + me.name()); | |
me.println(data); | |
me.println(me["pred"]); | |
}, | |
act: function() { | |
//me.println(""); | |
} | |
} | |
]]></filterbehavior> | |
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml, | |
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg"> | |
<g> | |
<title>UniversalSet</title> | |
<rect id="PhysicalSystem/UniversalSet" fill="#98FB98" height="50" width="50" x="25" y="0"/> | |
<g> | |
<title>filter</title> | |
<rect id="PhysicalSystem/filter" fill="#6AB06A" height="50" width="10" x="80" y="0"/> | |
</g> | |
</g> | |
</svg> | |
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient> | |
</XholonWorkbook> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment