Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation: R-gapminder Section 12 #52

Closed
rikutakei opened this issue Aug 20, 2019 · 0 comments · Fixed by #91
Closed

Translation: R-gapminder Section 12 #52

rikutakei opened this issue Aug 20, 2019 · 0 comments · Fixed by #91
Assignees

Comments

@rikutakei
Copy link
Collaborator

rikutakei commented Aug 20, 2019

Translation of section 12 on plyr (lines 16013 to 16938)

  • Please assign yourself to the issue before you start translating, so other people knows that you are translating
  • Once you have translated, send a pull request and reference this issue

セクション12 plyr の翻訳 (16013 から 16938 まで)

  • あなたが翻訳し始めたと分かるように、翻訳を始める前にこのイシューを自分に割り振って(assign)して下さい。
  • 翻訳が終わったら、プルリクエストを開いて、このイシューを参照・リンクして下さい。

i18n/po/r-novice-gapminder.ja.po

Lines 16013 to 16938 in 5f1d2d1

# Front Matter
#: r-novice-gapminder/_episodes/12-plyr.md:1
msgid ""
"---\n"
"# Please do not edit this file directly; it is auto generated.\n"
"# Instead, please edit 12-plyr.md in _episodes_rmd/\n"
"title: Splitting and Combining Data Frames with plyr\n"
"teaching: 30\n"
"exercises: 30\n"
"questions:\n"
"- \"How can I do different calculations on different sets of data?\"\n"
"objectives:\n"
"- \"To be able to use the split-apply-combine strategy for data analysis.\"\n"
"keypoints:\n"
"- \"Use the `plyr` package to split data, apply functions to subsets, and combine the results.\"\n"
"source: Rmd\n"
"---"
msgstr ""
"---\n"
"# Please do not edit this file directly; it is auto generated.\n"
"# Instead, please edit 12-plyr.md in _episodes_rmd/\n"
"title: Splitting and Combining Data Frames with plyr\n"
"teaching: 30\n"
"exercises: 30\n"
"questions:\n"
"- \"How can I do different calculations on different sets of data?\"\n"
"objectives:\n"
"- \"To be able to use the split-apply-combine strategy for data analysis.\"\n"
"keypoints:\n"
"- \"Use the `plyr` package to split data, apply functions to subsets, and combine the results.\"\n"
"source: Rmd\n"
"---"
#: r-novice-gapminder/_episodes/12-plyr.md:18
msgid ""
"Previously we looked at how you can use functions to simplify your code.\n"
"We defined the `calcGDP` function, which takes the gapminder dataset,\n"
"and multiplies the population and GDP per capita column. We also defined\n"
"additional arguments so we could filter by `year` and `country`:"
msgstr ""
"Previously we looked at how you can use functions to simplify your code.\n"
"We defined the `calcGDP` function, which takes the gapminder dataset,\n"
"and multiplies the population and GDP per capita column. We also defined\n"
"additional arguments so we could filter by `year` and `country`:"
#: r-novice-gapminder/_episodes/12-plyr.md:42
msgid ""
"A common task you'll encounter when working with data, is that you'll want to\n"
"run calculations on different groups within the data. In the above, we were\n"
"simply calculating the GDP by multiplying two columns together. But what if\n"
"we wanted to calculated the mean GDP per continent?"
msgstr ""
"A common task you'll encounter when working with data, is that you'll want to\n"
"run calculations on different groups within the data. In the above, we were\n"
"simply calculating the GDP by multiplying two columns together. But what if\n"
"we wanted to calculated the mean GDP per continent?"
#: r-novice-gapminder/_episodes/12-plyr.md:47
msgid "We could run `calcGDP` and then take the mean of each continent:"
msgstr "We could run `calcGDP` and then take the mean of each continent:"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:50
msgid ""
"~~~\n"
"withGDP <- calcGDP(gapminder)\n"
"mean(withGDP[withGDP$continent == \"Africa\", \"gdp\"])\n"
"~~~"
msgstr ""
"~~~\n"
"withGDP <- calcGDP(gapminder)\n"
"mean(withGDP[withGDP$continent == \"Africa\", \"gdp\"])\n"
"~~~"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:58
msgid ""
"~~~\n"
"[1] 20904782844\n"
"~~~"
msgstr ""
"~~~\n"
"[1] 20904782844\n"
"~~~"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:65
msgid ""
"~~~\n"
"mean(withGDP[withGDP$continent == \"Americas\", \"gdp\"])\n"
"~~~"
msgstr ""
"~~~\n"
"mean(withGDP[withGDP$continent == \"Americas\", \"gdp\"])\n"
"~~~"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:72
msgid ""
"~~~\n"
"[1] 379262350210\n"
"~~~"
msgstr ""
"~~~\n"
"[1] 379262350210\n"
"~~~"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:79
msgid ""
"~~~\n"
"mean(withGDP[withGDP$continent == \"Asia\", \"gdp\"])\n"
"~~~"
msgstr ""
"~~~\n"
"mean(withGDP[withGDP$continent == \"Asia\", \"gdp\"])\n"
"~~~"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:86
msgid ""
"~~~\n"
"[1] 227233738153\n"
"~~~"
msgstr ""
"~~~\n"
"[1] 227233738153\n"
"~~~"
#: r-novice-gapminder/_episodes/12-plyr.md:91
msgid ""
"But this isn't very *nice*. Yes, by using a function, you have reduced a\n"
"substantial amount of repetition. That **is** nice. But there is still\n"
"repetition. Repeating yourself will cost you time, both now and later, and\n"
"potentially introduce some nasty bugs."
msgstr ""
"But this isn't very *nice*. Yes, by using a function, you have reduced a\n"
"substantial amount of repetition. That **is** nice. But there is still\n"
"repetition. Repeating yourself will cost you time, both now and later, and\n"
"potentially introduce some nasty bugs."
#: r-novice-gapminder/_episodes/12-plyr.md:96
msgid ""
"We could write a new function that is flexible like `calcGDP`, but this\n"
"also takes a substantial amount of effort and testing to get right."
msgstr ""
"We could write a new function that is flexible like `calcGDP`, but this\n"
"also takes a substantial amount of effort and testing to get right."
#: r-novice-gapminder/_episodes/12-plyr.md:99
msgid "The abstract problem we're encountering here is know as \"split-apply-combine\":"
msgstr "The abstract problem we're encountering here is know as \"split-apply-combine\":"
#: r-novice-gapminder/_episodes/12-plyr.md:101
msgid "![Split apply combine](../fig/12-plyr-fig1.png)"
msgstr "![Split apply combine](../fig/12-plyr-fig1.png)"
#: r-novice-gapminder/_episodes/12-plyr.md:103
msgid ""
"We want to *split* our data into groups, in this case continents, *apply*\n"
"some calculations on that group, then optionally *combine* the results\n"
"together afterwards."
msgstr ""
"We want to *split* our data into groups, in this case continents, *apply*\n"
"some calculations on that group, then optionally *combine* the results\n"
"together afterwards."
# header
#: r-novice-gapminder/_episodes/12-plyr.md:107
msgid "## The `plyr` package"
msgstr "## The `plyr` package"
#: r-novice-gapminder/_episodes/12-plyr.md:109
msgid ""
"For those of you who have used R before, you might be familiar with the\n"
"`apply` family of functions. While R's built in functions do work, we're\n"
"going to introduce you to another method for solving the \"split-apply-combine\"\n"
"problem. The [plyr](http://had.co.nz/plyr/) package provides a set of\n"
"functions that we find more user friendly for solving this problem."
msgstr ""
"For those of you who have used R before, you might be familiar with the\n"
"`apply` family of functions. While R's built in functions do work, we're\n"
"going to introduce you to another method for solving the \"split-apply-combine\"\n"
"problem. The [plyr](http://had.co.nz/plyr/) package provides a set of\n"
"functions that we find more user friendly for solving this problem."
#: r-novice-gapminder/_episodes/12-plyr.md:115
msgid "We installed this package in an earlier challenge. Let's load it now:"
msgstr "We installed this package in an earlier challenge. Let's load it now:"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:118
msgid ""
"~~~\n"
"library(\"plyr\")\n"
"~~~"
msgstr ""
"~~~\n"
"library(\"plyr\")\n"
"~~~"
#: r-novice-gapminder/_episodes/12-plyr.md:123
msgid ""
"Plyr has functions for operating on `lists`, `data.frames` and `arrays`\n"
"(matrices, or n-dimensional vectors). Each function performs:"
msgstr ""
"Plyr has functions for operating on `lists`, `data.frames` and `arrays`\n"
"(matrices, or n-dimensional vectors). Each function performs:"
# ordered list
#: r-novice-gapminder/_episodes/12-plyr.md:126
msgid "1. A **split**ting operation"
msgstr "1. A **split**ting operation"
# ordered list
#: r-novice-gapminder/_episodes/12-plyr.md:127
msgid "2. **Apply** a function on each split in turn."
msgstr "2. **Apply** a function on each split in turn."
# ordered list
#: r-novice-gapminder/_episodes/12-plyr.md:128
msgid "3. Re**combine** output data as a single data object."
msgstr "3. Re**combine** output data as a single data object."
#: r-novice-gapminder/_episodes/12-plyr.md:130
msgid ""
"The functions are named based on the data structure they expect as input,\n"
"and the data structure you want returned as output: [a]rray, [l]ist, or\n"
"[d]ata.frame. The first letter corresponds to the input data structure,\n"
"the second letter to the output data structure, and then the rest of the\n"
"function is named \"ply\"."
msgstr ""
"The functions are named based on the data structure they expect as input,\n"
"and the data structure you want returned as output: [a]rray, [l]ist, or\n"
"[d]ata.frame. The first letter corresponds to the input data structure,\n"
"the second letter to the output data structure, and then the rest of the\n"
"function is named \"ply\"."
#: r-novice-gapminder/_episodes/12-plyr.md:136
msgid ""
"This gives us 9 core functions **ply. There are an additional three functions\n"
"which will only perform the split and apply steps, and not any combine step.\n"
"They're named by their input data type and represent null output by a `_` (see\n"
"table)"
msgstr ""
"This gives us 9 core functions **ply. There are an additional three functions\n"
"which will only perform the split and apply steps, and not any combine step.\n"
"They're named by their input data type and represent null output by a `_` (see\n"
"table)"
#: r-novice-gapminder/_episodes/12-plyr.md:141
msgid ""
"Note here that plyr's use of \"array\" is different to R's,\n"
"an array in ply can include a vector or matrix."
msgstr ""
"Note here that plyr's use of \"array\" is different to R's,\n"
"an array in ply can include a vector or matrix."
#: r-novice-gapminder/_episodes/12-plyr.md:144
msgid "![Full apply suite](../fig/12-plyr-fig2.png)"
msgstr "![Full apply suite](../fig/12-plyr-fig2.png)"
#: r-novice-gapminder/_episodes/12-plyr.md:147
msgid ""
"Each of the xxply functions (`daply`, `ddply`, `llply`, `laply`, ...) has the\n"
"same structure and has 4 key features and structure:"
msgstr ""
"Each of the xxply functions (`daply`, `ddply`, `llply`, `laply`, ...) has the\n"
"same structure and has 4 key features and structure:"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:151
msgid ""
"~~~\n"
"xxply(.data, .variables, .fun)\n"
"~~~"
msgstr ""
"~~~\n"
"xxply(.data, .variables, .fun)\n"
"~~~"
# unordered list
#: r-novice-gapminder/_episodes/12-plyr.md:156
msgid "* The first letter of the function name gives the input type and the second gives the output type."
msgstr "* The first letter of the function name gives the input type and the second gives the output type."
# unordered list
#: r-novice-gapminder/_episodes/12-plyr.md:157
msgid "* .data - gives the data object to be processed"
msgstr "* .data - gives the data object to be processed"
# unordered list
#: r-novice-gapminder/_episodes/12-plyr.md:158
msgid "* .variables - identifies the splitting variables"
msgstr "* .variables - identifies the splitting variables"
# unordered list
#: r-novice-gapminder/_episodes/12-plyr.md:159
msgid "* .fun - gives the function to be called on each piece"
msgstr "* .fun - gives the function to be called on each piece"
#: r-novice-gapminder/_episodes/12-plyr.md:161
msgid "Now we can quickly calculate the mean GDP per continent:"
msgstr "Now we can quickly calculate the mean GDP per continent:"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:164
msgid ""
"~~~\n"
"ddply(\n"
" .data = calcGDP(gapminder),\n"
" .variables = \"continent\",\n"
" .fun = function(x) mean(x$gdp)\n"
")\n"
"~~~"
msgstr ""
"~~~\n"
"ddply(\n"
" .data = calcGDP(gapminder),\n"
" .variables = \"continent\",\n"
" .fun = function(x) mean(x$gdp)\n"
")\n"
"~~~"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:175
msgid ""
"~~~\n"
" continent V1\n"
"1 Africa 20904782844\n"
"2 Americas 379262350210\n"
"3 Asia 227233738153\n"
"4 Europe 269442085301\n"
"5 Oceania 188187105354\n"
"~~~"
msgstr ""
"~~~\n"
" continent V1\n"
"1 Africa 20904782844\n"
"2 Americas 379262350210\n"
"3 Asia 227233738153\n"
"4 Europe 269442085301\n"
"5 Oceania 188187105354\n"
"~~~"
#: r-novice-gapminder/_episodes/12-plyr.md:185
msgid "Let's walk through the previous code:"
msgstr "Let's walk through the previous code:"
# unordered list
#: r-novice-gapminder/_episodes/12-plyr.md:187
msgid "- The `ddply` function feeds in a `data.frame` (function starts with **d**) and"
msgstr "- The `ddply` function feeds in a `data.frame` (function starts with **d**) and"
#: r-novice-gapminder/_episodes/12-plyr.md:188
msgid ""
"returns another `data.frame` (2nd letter is a **d**) i\n"
"- the first argument we gave was the data.frame we wanted to operate on: in this\n"
" case the gapminder data. We called `calcGDP` on it first so that it would have\n"
" the additional `gdp` column added to it.\n"
"- The second argument indicated our split criteria: in this case the \"continent\"\n"
" column. Note that we gave the name of the column, not the values of the column like we had done previously with subsetting. Plyr takes care of these\n"
" implementation details for you.\n"
"- The third argument is the function we want to apply to each grouping of the\n"
" data. We had to define our own short function here: each subset of the data\n"
" gets stored in `x`, the first argument of our function. This is an anonymous\n"
" function: we haven't defined it elsewhere, and it has no name. It only exists\n"
" in the scope of our call to `ddply`."
msgstr ""
"returns another `data.frame` (2nd letter is a **d**) i\n"
"- the first argument we gave was the data.frame we wanted to operate on: in this\n"
" case the gapminder data. We called `calcGDP` on it first so that it would have\n"
" the additional `gdp` column added to it.\n"
"- The second argument indicated our split criteria: in this case the \"continent\"\n"
" column. Note that we gave the name of the column, not the values of the column like we had done previously with subsetting. Plyr takes care of these\n"
" implementation details for you.\n"
"- The third argument is the function we want to apply to each grouping of the\n"
" data. We had to define our own short function here: each subset of the data\n"
" gets stored in `x`, the first argument of our function. This is an anonymous\n"
" function: we haven't defined it elsewhere, and it has no name. It only exists\n"
" in the scope of our call to `ddply`."
#: r-novice-gapminder/_episodes/12-plyr.md:202
msgid ""
">\n"
"> Calculate the average life expectancy per continent. Which has the longest?\n"
"> Which had the shortest?"
msgstr ""
">\n"
"> Calculate the average life expectancy per continent. Which has the longest?\n"
"> Which had the shortest?"
#: r-novice-gapminder/_episodes/12-plyr.md:207
msgid "What if we want a different type of output data structure?:"
msgstr "What if we want a different type of output data structure?:"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:210
msgid ""
"~~~\n"
"dlply(\n"
" .data = calcGDP(gapminder),\n"
" .variables = \"continent\",\n"
" .fun = function(x) mean(x$gdp)\n"
")\n"
"~~~"
msgstr ""
"~~~\n"
"dlply(\n"
" .data = calcGDP(gapminder),\n"
" .variables = \"continent\",\n"
" .fun = function(x) mean(x$gdp)\n"
")\n"
"~~~"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:221
msgid ""
"~~~\n"
"$Africa\n"
"[1] 20904782844\n"
"\n"
"$Americas\n"
"[1] 379262350210\n"
"\n"
"$Asia\n"
"[1] 227233738153\n"
"\n"
"$Europe\n"
"[1] 269442085301\n"
"\n"
"$Oceania\n"
"[1] 188187105354\n"
"\n"
"attr(,\"split_type\")\n"
"[1] \"data.frame\"\n"
"attr(,\"split_labels\")\n"
" continent\n"
"1 Africa\n"
"2 Americas\n"
"3 Asia\n"
"4 Europe\n"
"5 Oceania\n"
"~~~"
msgstr ""
"~~~\n"
"$Africa\n"
"[1] 20904782844\n"
"\n"
"$Americas\n"
"[1] 379262350210\n"
"\n"
"$Asia\n"
"[1] 227233738153\n"
"\n"
"$Europe\n"
"[1] 269442085301\n"
"\n"
"$Oceania\n"
"[1] 188187105354\n"
"\n"
"attr(,\"split_type\")\n"
"[1] \"data.frame\"\n"
"attr(,\"split_labels\")\n"
" continent\n"
"1 Africa\n"
"2 Americas\n"
"3 Asia\n"
"4 Europe\n"
"5 Oceania\n"
"~~~"
#: r-novice-gapminder/_episodes/12-plyr.md:249
msgid ""
"We called the same function again, but changed the second letter to an `l`, so\n"
"the output was returned as a list."
msgstr ""
"We called the same function again, but changed the second letter to an `l`, so\n"
"the output was returned as a list."
#: r-novice-gapminder/_episodes/12-plyr.md:252
msgid "We can specify multiple columns to group by:"
msgstr "We can specify multiple columns to group by:"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:255
msgid ""
"~~~\n"
"ddply(\n"
" .data = calcGDP(gapminder),\n"
" .variables = c(\"continent\", \"year\"),\n"
" .fun = function(x) mean(x$gdp)\n"
")\n"
"~~~"
msgstr ""
"~~~\n"
"ddply(\n"
" .data = calcGDP(gapminder),\n"
" .variables = c(\"continent\", \"year\"),\n"
" .fun = function(x) mean(x$gdp)\n"
")\n"
"~~~"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:266
msgid ""
"~~~\n"
" continent year V1\n"
"1 Africa 1952 5992294608\n"
"2 Africa 1957 7359188796\n"
"3 Africa 1962 8784876958\n"
"4 Africa 1967 11443994101\n"
"5 Africa 1972 15072241974\n"
"6 Africa 1977 18694898732\n"
"7 Africa 1982 22040401045\n"
"8 Africa 1987 24107264108\n"
"9 Africa 1992 26256977719\n"
"10 Africa 1997 30023173824\n"
"11 Africa 2002 35303511424\n"
"12 Africa 2007 45778570846\n"
"13 Americas 1952 117738997171\n"
"14 Americas 1957 140817061264\n"
"15 Americas 1962 169153069442\n"
"16 Americas 1967 217867530844\n"
"17 Americas 1972 268159178814\n"
"18 Americas 1977 324085389022\n"
"19 Americas 1982 363314008350\n"
"20 Americas 1987 439447790357\n"
"21 Americas 1992 489899820623\n"
"22 Americas 1997 582693307146\n"
"23 Americas 2002 661248623419\n"
"24 Americas 2007 776723426068\n"
"25 Asia 1952 34095762661\n"
"26 Asia 1957 47267432088\n"
"27 Asia 1962 60136869012\n"
"28 Asia 1967 84648519224\n"
"29 Asia 1972 124385747313\n"
"30 Asia 1977 159802590186\n"
"31 Asia 1982 194429049919\n"
"32 Asia 1987 241784763369\n"
"33 Asia 1992 307100497486\n"
"34 Asia 1997 387597655323\n"
"35 Asia 2002 458042336179\n"
"36 Asia 2007 627513635079\n"
"37 Europe 1952 84971341466\n"
"38 Europe 1957 109989505140\n"
"39 Europe 1962 138984693095\n"
"40 Europe 1967 173366641137\n"
"41 Europe 1972 218691462733\n"
"42 Europe 1977 255367522034\n"
"43 Europe 1982 279484077072\n"
"44 Europe 1987 316507473546\n"
"45 Europe 1992 342703247405\n"
"46 Europe 1997 383606933833\n"
"47 Europe 2002 436448815097\n"
"48 Europe 2007 493183311052\n"
"49 Oceania 1952 54157223944\n"
"50 Oceania 1957 66826828013\n"
"51 Oceania 1962 82336453245\n"
"52 Oceania 1967 105958863585\n"
"53 Oceania 1972 134112109227\n"
"54 Oceania 1977 154707711162\n"
"55 Oceania 1982 176177151380\n"
"56 Oceania 1987 209451563998\n"
"57 Oceania 1992 236319179826\n"
"58 Oceania 1997 289304255183\n"
"59 Oceania 2002 345236880176\n"
"60 Oceania 2007 403657044512\n"
"~~~"
msgstr ""
"~~~\n"
" continent year V1\n"
"1 Africa 1952 5992294608\n"
"2 Africa 1957 7359188796\n"
"3 Africa 1962 8784876958\n"
"4 Africa 1967 11443994101\n"
"5 Africa 1972 15072241974\n"
"6 Africa 1977 18694898732\n"
"7 Africa 1982 22040401045\n"
"8 Africa 1987 24107264108\n"
"9 Africa 1992 26256977719\n"
"10 Africa 1997 30023173824\n"
"11 Africa 2002 35303511424\n"
"12 Africa 2007 45778570846\n"
"13 Americas 1952 117738997171\n"
"14 Americas 1957 140817061264\n"
"15 Americas 1962 169153069442\n"
"16 Americas 1967 217867530844\n"
"17 Americas 1972 268159178814\n"
"18 Americas 1977 324085389022\n"
"19 Americas 1982 363314008350\n"
"20 Americas 1987 439447790357\n"
"21 Americas 1992 489899820623\n"
"22 Americas 1997 582693307146\n"
"23 Americas 2002 661248623419\n"
"24 Americas 2007 776723426068\n"
"25 Asia 1952 34095762661\n"
"26 Asia 1957 47267432088\n"
"27 Asia 1962 60136869012\n"
"28 Asia 1967 84648519224\n"
"29 Asia 1972 124385747313\n"
"30 Asia 1977 159802590186\n"
"31 Asia 1982 194429049919\n"
"32 Asia 1987 241784763369\n"
"33 Asia 1992 307100497486\n"
"34 Asia 1997 387597655323\n"
"35 Asia 2002 458042336179\n"
"36 Asia 2007 627513635079\n"
"37 Europe 1952 84971341466\n"
"38 Europe 1957 109989505140\n"
"39 Europe 1962 138984693095\n"
"40 Europe 1967 173366641137\n"
"41 Europe 1972 218691462733\n"
"42 Europe 1977 255367522034\n"
"43 Europe 1982 279484077072\n"
"44 Europe 1987 316507473546\n"
"45 Europe 1992 342703247405\n"
"46 Europe 1997 383606933833\n"
"47 Europe 2002 436448815097\n"
"48 Europe 2007 493183311052\n"
"49 Oceania 1952 54157223944\n"
"50 Oceania 1957 66826828013\n"
"51 Oceania 1962 82336453245\n"
"52 Oceania 1967 105958863585\n"
"53 Oceania 1972 134112109227\n"
"54 Oceania 1977 154707711162\n"
"55 Oceania 1982 176177151380\n"
"56 Oceania 1987 209451563998\n"
"57 Oceania 1992 236319179826\n"
"58 Oceania 1997 289304255183\n"
"59 Oceania 2002 345236880176\n"
"60 Oceania 2007 403657044512\n"
"~~~"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:332
msgid ""
"~~~\n"
"daply(\n"
" .data = calcGDP(gapminder),\n"
" .variables = c(\"continent\", \"year\"),\n"
" .fun = function(x) mean(x$gdp)\n"
")\n"
"~~~"
msgstr ""
"~~~\n"
"daply(\n"
" .data = calcGDP(gapminder),\n"
" .variables = c(\"continent\", \"year\"),\n"
" .fun = function(x) mean(x$gdp)\n"
")\n"
"~~~"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:343
msgid ""
"~~~\n"
" year\n"
"continent 1952 1957 1962 1967\n"
" Africa 5992294608 7359188796 8784876958 11443994101\n"
" Americas 117738997171 140817061264 169153069442 217867530844\n"
" Asia 34095762661 47267432088 60136869012 84648519224\n"
" Europe 84971341466 109989505140 138984693095 173366641137\n"
" Oceania 54157223944 66826828013 82336453245 105958863585\n"
" year\n"
"continent 1972 1977 1982 1987\n"
" Africa 15072241974 18694898732 22040401045 24107264108\n"
" Americas 268159178814 324085389022 363314008350 439447790357\n"
" Asia 124385747313 159802590186 194429049919 241784763369\n"
" Europe 218691462733 255367522034 279484077072 316507473546\n"
" Oceania 134112109227 154707711162 176177151380 209451563998\n"
" year\n"
"continent 1992 1997 2002 2007\n"
" Africa 26256977719 30023173824 35303511424 45778570846\n"
" Americas 489899820623 582693307146 661248623419 776723426068\n"
" Asia 307100497486 387597655323 458042336179 627513635079\n"
" Europe 342703247405 383606933833 436448815097 493183311052\n"
" Oceania 236319179826 289304255183 345236880176 403657044512\n"
"~~~"
msgstr ""
"~~~\n"
" year\n"
"continent 1952 1957 1962 1967\n"
" Africa 5992294608 7359188796 8784876958 11443994101\n"
" Americas 117738997171 140817061264 169153069442 217867530844\n"
" Asia 34095762661 47267432088 60136869012 84648519224\n"
" Europe 84971341466 109989505140 138984693095 173366641137\n"
" Oceania 54157223944 66826828013 82336453245 105958863585\n"
" year\n"
"continent 1972 1977 1982 1987\n"
" Africa 15072241974 18694898732 22040401045 24107264108\n"
" Americas 268159178814 324085389022 363314008350 439447790357\n"
" Asia 124385747313 159802590186 194429049919 241784763369\n"
" Europe 218691462733 255367522034 279484077072 316507473546\n"
" Oceania 134112109227 154707711162 176177151380 209451563998\n"
" year\n"
"continent 1992 1997 2002 2007\n"
" Africa 26256977719 30023173824 35303511424 45778570846\n"
" Americas 489899820623 582693307146 661248623419 776723426068\n"
" Asia 307100497486 387597655323 458042336179 627513635079\n"
" Europe 342703247405 383606933833 436448815097 493183311052\n"
" Oceania 236319179826 289304255183 345236880176 403657044512\n"
"~~~"
#: r-novice-gapminder/_episodes/12-plyr.md:368
msgid ""
"You can use these functions in place of `for` loops (and its usually faster to\n"
"do so).\n"
"To replace a for loop, put the code that was in the body of the `for` loop inside an anonymous function."
msgstr ""
"You can use these functions in place of `for` loops (and its usually faster to\n"
"do so).\n"
"To replace a for loop, put the code that was in the body of the `for` loop inside an anonymous function."
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:373
msgid ""
"~~~\n"
"d_ply(\n"
" .data=gapminder,\n"
" .variables = \"continent\",\n"
" .fun = function(x) {\n"
" meanGDPperCap <- mean(x$gdpPercap)\n"
" print(paste(\n"
" \"The mean GDP per capita for\", unique(x$continent),\n"
" \"is\", format(meanGDPperCap, big.mark=\",\")\n"
" ))\n"
" }\n"
")\n"
"~~~"
msgstr ""
"~~~\n"
"d_ply(\n"
" .data=gapminder,\n"
" .variables = \"continent\",\n"
" .fun = function(x) {\n"
" meanGDPperCap <- mean(x$gdpPercap)\n"
" print(paste(\n"
" \"The mean GDP per capita for\", unique(x$continent),\n"
" \"is\", format(meanGDPperCap, big.mark=\",\")\n"
" ))\n"
" }\n"
")\n"
"~~~"
# code block
#: r-novice-gapminder/_episodes/12-plyr.md:390
msgid ""
"~~~\n"
"[1] \"The mean GDP per capita for Africa is 2,193.755\"\n"
"[1] \"The mean GDP per capita for Americas is 7,136.11\"\n"
"[1] \"The mean GDP per capita for Asia is 7,902.15\"\n"
"[1] \"The mean GDP per capita for Europe is 14,469.48\"\n"
"[1] \"The mean GDP per capita for Oceania is 18,621.61\"\n"
"~~~"
msgstr ""
"~~~\n"
"[1] \"The mean GDP per capita for Africa is 2,193.755\"\n"
"[1] \"The mean GDP per capita for Americas is 7,136.11\"\n"
"[1] \"The mean GDP per capita for Asia is 7,902.15\"\n"
"[1] \"The mean GDP per capita for Europe is 14,469.48\"\n"
"[1] \"The mean GDP per capita for Oceania is 18,621.61\"\n"
"~~~"
# blockquote, which can be cascaded
#: r-novice-gapminder/_episodes/12-plyr.md:399
msgid "> ## Tip: printing numbers"
msgstr "> ## Tip: printing numbers"
#: r-novice-gapminder/_episodes/12-plyr.md:400
msgid ""
">\n"
"> The `format` function can be used to make numeric\n"
"> values \"pretty\" for printing out in messages."
msgstr ""
">\n"
"> The `format` function can be used to make numeric\n"
"> values \"pretty\" for printing out in messages."
#: r-novice-gapminder/_episodes/12-plyr.md:407
msgid ""
">\n"
"> Calculate the average life expectancy per continent and year. Which had the\n"
"> longest and shortest in 2007? Which had the greatest change in between 1952\n"
"> and 2007?"
msgstr ""
">\n"
"> Calculate the average life expectancy per continent and year. Which had the\n"
"> longest and shortest in 2007? Which had the greatest change in between 1952\n"
"> and 2007?"
# blockquote, which can be cascaded
#: r-novice-gapminder/_episodes/12-plyr.md:414
#: r-novice-gapminder/_episodes/13-dplyr.md:572
msgid "> ## Advanced Challenge"
msgstr "> ## Advanced Challenge"
#: r-novice-gapminder/_episodes/12-plyr.md:415
msgid ""
">\n"
"> Calculate the difference in mean life expectancy between\n"
"> the years 1952 and 2007 from the output of challenge 2\n"
"> using one of the `plyr` functions."
msgstr ""
">\n"
"> Calculate the difference in mean life expectancy between\n"
"> the years 1952 and 2007 from the output of challenge 2\n"
"> using one of the `plyr` functions."
# blockquote, which can be cascaded
#: r-novice-gapminder/_episodes/12-plyr.md:421
msgid "> ## Alternate Challenge if class seems lost"
msgstr "> ## Alternate Challenge if class seems lost"
#: r-novice-gapminder/_episodes/12-plyr.md:422
msgid ""
">\n"
"> Without running them, which of the following will calculate the average\n"
"> life expectancy per continent:\n"
">\n"
"> 1.\n"
"> \n"
"> ~~~\n"
"> ddply(\n"
"> .data = gapminder,\n"
"> .variables = gapminder$continent,\n"
"> .fun = function(dataGroup) {\n"
"> mean(dataGroup$lifeExp)\n"
"> }\n"
"> )\n"
"> ~~~\n"
"> {: .language-r}\n"
">\n"
"> 2.\n"
"> \n"
"> ~~~\n"
"> ddply(\n"
"> .data = gapminder,\n"
"> .variables = \"continent\",\n"
"> .fun = mean(dataGroup$lifeExp)\n"
"> )\n"
"> ~~~\n"
"> {: .language-r}\n"
">\n"
"> 3.\n"
"> \n"
"> ~~~\n"
"> ddply(\n"
"> .data = gapminder,\n"
"> .variables = \"continent\",\n"
"> .fun = function(dataGroup) {\n"
"> mean(dataGroup$lifeExp)\n"
"> }\n"
"> )\n"
"> ~~~\n"
"> {: .language-r}\n"
">\n"
"> 4.\n"
"> \n"
"> ~~~\n"
"> adply(\n"
"> .data = gapminder,\n"
"> .variables = \"continent\",\n"
"> .fun = function(dataGroup) {\n"
"> mean(dataGroup$lifeExp)\n"
"> }\n"
"> )\n"
"> ~~~\n"
"> {: .language-r}\n"
">"
msgstr ""
">\n"
"> Without running them, which of the following will calculate the average\n"
"> life expectancy per continent:\n"
">\n"
"> 1.\n"
"> \n"
"> ~~~\n"
"> ddply(\n"
"> .data = gapminder,\n"
"> .variables = gapminder$continent,\n"
"> .fun = function(dataGroup) {\n"
"> mean(dataGroup$lifeExp)\n"
"> }\n"
"> )\n"
"> ~~~\n"
"> {: .language-r}\n"
">\n"
"> 2.\n"
"> \n"
"> ~~~\n"
"> ddply(\n"
"> .data = gapminder,\n"
"> .variables = \"continent\",\n"
"> .fun = mean(dataGroup$lifeExp)\n"
"> )\n"
"> ~~~\n"
"> {: .language-r}\n"
">\n"
"> 3.\n"
"> \n"
"> ~~~\n"
"> ddply(\n"
"> .data = gapminder,\n"
"> .variables = \"continent\",\n"
"> .fun = function(dataGroup) {\n"
"> mean(dataGroup$lifeExp)\n"
"> }\n"
"> )\n"
"> ~~~\n"
"> {: .language-r}\n"
">\n"
"> 4.\n"
"> \n"
"> ~~~\n"
"> adply(\n"
"> .data = gapminder,\n"
"> .variables = \"continent\",\n"
"> .fun = function(dataGroup) {\n"
"> mean(dataGroup$lifeExp)\n"
"> }\n"
"> )\n"
"> ~~~\n"
"> {: .language-r}\n"
">"

@joelnitta joelnitta changed the title Translation: Lesson 12 Translation: R-gapminder Section 12 Dec 6, 2019
@rkkmk rkkmk self-assigned this Mar 21, 2020
@rkkmk rkkmk linked a pull request Apr 11, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants