Technical name for this data wrangling process? Multiple columns into multi-factor single columnSort a data frame when column name is assigned in a variableAnalytics term for turning row values into column names and count its assigned valuesReplacing values in multiple columns of a data frame in RHow to adapt output with multiple columns for better presentation?Do modern R and/or Python libraries make SQL obsolete?Spliting training data into multiple variables using RWhat is the appropriate name for this dataset?A single column has many values per row, separated by a comma. How to create an individual column for each of these?How to access substrings in pandas column and store it into new columns?
How to define limit operations in general topological spaces? Are nets able to do this?
Why are there no stars visible in cislunar space?
World War I as a war of liberals against authoritarians?
Is honey really a supersaturated solution? Does heating to un-crystalize redissolve it or melt it?
Is it true that good novels will automatically sell themselves on Amazon (and so on) and there is no need for one to waste time promoting?
Help rendering a complicated sum/product formula
Violin - Can double stops be played when the strings are not next to each other?
Have the tides ever turned twice on any open problem?
When to use snap-off blade knife and when to use trapezoid blade knife?
Are dual Irish/British citizens bound by the 90/180 day rule when travelling in the EU after Brexit?
How could an airship be repaired midflight?
Do US professors/group leaders only get a salary, but no group budget?
HP P840 HDD RAID 5 many strange drive failures
What does "Four-F." mean?
Comment Box for Substitution Method of Integrals
What does Deadpool mean by "left the house in that shirt"?
Wrapping homogeneous Python objects
Knife as defense against stray dogs
Existence of a celestial body big enough for early civilization to be thought of as a second moon
Using Past-Perfect interchangeably with the Past Continuous
How does 取材で訪れた integrate into this sentence?
Pronounciation of the combination "st" in spanish accents
I got the following comment from a reputed math journal. What does it mean?
Does .bashrc contain syntax errors?
Technical name for this data wrangling process? Multiple columns into multi-factor single column
Sort a data frame when column name is assigned in a variableAnalytics term for turning row values into column names and count its assigned valuesReplacing values in multiple columns of a data frame in RHow to adapt output with multiple columns for better presentation?Do modern R and/or Python libraries make SQL obsolete?Spliting training data into multiple variables using RWhat is the appropriate name for this dataset?A single column has many values per row, separated by a comma. How to create an individual column for each of these?How to access substrings in pandas column and store it into new columns?
$begingroup$
What is the technical name for the following data wrangling process? I want to collapse Table A into Table B. (To make the data suitable for ANOVA.)
Table A:
ArmyVet_ID Served_WW2 Served_KoreanWar Served_VietnamWar
110001 1 0 0
110002 1 0 0
110004 0 1 0
110005 0 1 0
110009 0 0 1
110010 0 0 1
Table B:
ArmyVet_ID Served
110001 WW2
110002 WW2
110004 KoreanWar
110005 KoreanWar
110009 VietnamWar
110010 VietnamWar
Also, the question of how to do the above conversion using R has been asked to death on SO. However, there seem to be way too many ways to do it. If anyone's figured out the absolutely best way to do it (quickest, easiest), I'd appreciate pointers.
Update after correct answer marked below: It turns out that Table A is called "wide format" and B is called "long format".
r dataset data-cleaning data-wrangling
$endgroup$
add a comment |
$begingroup$
What is the technical name for the following data wrangling process? I want to collapse Table A into Table B. (To make the data suitable for ANOVA.)
Table A:
ArmyVet_ID Served_WW2 Served_KoreanWar Served_VietnamWar
110001 1 0 0
110002 1 0 0
110004 0 1 0
110005 0 1 0
110009 0 0 1
110010 0 0 1
Table B:
ArmyVet_ID Served
110001 WW2
110002 WW2
110004 KoreanWar
110005 KoreanWar
110009 VietnamWar
110010 VietnamWar
Also, the question of how to do the above conversion using R has been asked to death on SO. However, there seem to be way too many ways to do it. If anyone's figured out the absolutely best way to do it (quickest, easiest), I'd appreciate pointers.
Update after correct answer marked below: It turns out that Table A is called "wide format" and B is called "long format".
r dataset data-cleaning data-wrangling
$endgroup$
2
$begingroup$
The answer given is right, but 'wide format to long format' might be even more specific, also, I recommend reshape2 instead of reshape, reshape is, as I understand it, underdocumented
$endgroup$
– Shape
Jun 8 '16 at 22:42
1
$begingroup$
@Shape Do you know of any more synonyms of "reshape"? It shocks me that when I look for 'reshape' and Weka or Rapidminer I get nothing on google.
$endgroup$
– thanks_in_advance
Jun 9 '16 at 6:08
1
$begingroup$
It's "normalization" in database theory.
$endgroup$
– Diego
Jun 9 '16 at 8:55
add a comment |
$begingroup$
What is the technical name for the following data wrangling process? I want to collapse Table A into Table B. (To make the data suitable for ANOVA.)
Table A:
ArmyVet_ID Served_WW2 Served_KoreanWar Served_VietnamWar
110001 1 0 0
110002 1 0 0
110004 0 1 0
110005 0 1 0
110009 0 0 1
110010 0 0 1
Table B:
ArmyVet_ID Served
110001 WW2
110002 WW2
110004 KoreanWar
110005 KoreanWar
110009 VietnamWar
110010 VietnamWar
Also, the question of how to do the above conversion using R has been asked to death on SO. However, there seem to be way too many ways to do it. If anyone's figured out the absolutely best way to do it (quickest, easiest), I'd appreciate pointers.
Update after correct answer marked below: It turns out that Table A is called "wide format" and B is called "long format".
r dataset data-cleaning data-wrangling
$endgroup$
What is the technical name for the following data wrangling process? I want to collapse Table A into Table B. (To make the data suitable for ANOVA.)
Table A:
ArmyVet_ID Served_WW2 Served_KoreanWar Served_VietnamWar
110001 1 0 0
110002 1 0 0
110004 0 1 0
110005 0 1 0
110009 0 0 1
110010 0 0 1
Table B:
ArmyVet_ID Served
110001 WW2
110002 WW2
110004 KoreanWar
110005 KoreanWar
110009 VietnamWar
110010 VietnamWar
Also, the question of how to do the above conversion using R has been asked to death on SO. However, there seem to be way too many ways to do it. If anyone's figured out the absolutely best way to do it (quickest, easiest), I'd appreciate pointers.
Update after correct answer marked below: It turns out that Table A is called "wide format" and B is called "long format".
r dataset data-cleaning data-wrangling
r dataset data-cleaning data-wrangling
edited Jun 7 '16 at 3:04
thanks_in_advance
asked Jun 7 '16 at 1:42
thanks_in_advancethanks_in_advance
20116
20116
2
$begingroup$
The answer given is right, but 'wide format to long format' might be even more specific, also, I recommend reshape2 instead of reshape, reshape is, as I understand it, underdocumented
$endgroup$
– Shape
Jun 8 '16 at 22:42
1
$begingroup$
@Shape Do you know of any more synonyms of "reshape"? It shocks me that when I look for 'reshape' and Weka or Rapidminer I get nothing on google.
$endgroup$
– thanks_in_advance
Jun 9 '16 at 6:08
1
$begingroup$
It's "normalization" in database theory.
$endgroup$
– Diego
Jun 9 '16 at 8:55
add a comment |
2
$begingroup$
The answer given is right, but 'wide format to long format' might be even more specific, also, I recommend reshape2 instead of reshape, reshape is, as I understand it, underdocumented
$endgroup$
– Shape
Jun 8 '16 at 22:42
1
$begingroup$
@Shape Do you know of any more synonyms of "reshape"? It shocks me that when I look for 'reshape' and Weka or Rapidminer I get nothing on google.
$endgroup$
– thanks_in_advance
Jun 9 '16 at 6:08
1
$begingroup$
It's "normalization" in database theory.
$endgroup$
– Diego
Jun 9 '16 at 8:55
2
2
$begingroup$
The answer given is right, but 'wide format to long format' might be even more specific, also, I recommend reshape2 instead of reshape, reshape is, as I understand it, underdocumented
$endgroup$
– Shape
Jun 8 '16 at 22:42
$begingroup$
The answer given is right, but 'wide format to long format' might be even more specific, also, I recommend reshape2 instead of reshape, reshape is, as I understand it, underdocumented
$endgroup$
– Shape
Jun 8 '16 at 22:42
1
1
$begingroup$
@Shape Do you know of any more synonyms of "reshape"? It shocks me that when I look for 'reshape' and Weka or Rapidminer I get nothing on google.
$endgroup$
– thanks_in_advance
Jun 9 '16 at 6:08
$begingroup$
@Shape Do you know of any more synonyms of "reshape"? It shocks me that when I look for 'reshape' and Weka or Rapidminer I get nothing on google.
$endgroup$
– thanks_in_advance
Jun 9 '16 at 6:08
1
1
$begingroup$
It's "normalization" in database theory.
$endgroup$
– Diego
Jun 9 '16 at 8:55
$begingroup$
It's "normalization" in database theory.
$endgroup$
– Diego
Jun 9 '16 at 8:55
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
It is usually called reshaping! For a great description of the process, see this walkthrough, or read up on Hadley Wickham's documentation for the reshape
package!
$endgroup$
add a comment |
$begingroup$
df['Served'] = (df.iloc[:, 1:] == 1).idxmax(1)
New contributor
$endgroup$
$begingroup$
Welcome to the site! I have submitted an edit for your answer so that it displays as properly formatted code with the markdown language.
$endgroup$
– I_Play_With_Data
2 days ago
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "557"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f12099%2ftechnical-name-for-this-data-wrangling-process-multiple-columns-into-multi-fact%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
It is usually called reshaping! For a great description of the process, see this walkthrough, or read up on Hadley Wickham's documentation for the reshape
package!
$endgroup$
add a comment |
$begingroup$
It is usually called reshaping! For a great description of the process, see this walkthrough, or read up on Hadley Wickham's documentation for the reshape
package!
$endgroup$
add a comment |
$begingroup$
It is usually called reshaping! For a great description of the process, see this walkthrough, or read up on Hadley Wickham's documentation for the reshape
package!
$endgroup$
It is usually called reshaping! For a great description of the process, see this walkthrough, or read up on Hadley Wickham's documentation for the reshape
package!
answered Jun 7 '16 at 2:13
Kyle.Kyle.
1,2001829
1,2001829
add a comment |
add a comment |
$begingroup$
df['Served'] = (df.iloc[:, 1:] == 1).idxmax(1)
New contributor
$endgroup$
$begingroup$
Welcome to the site! I have submitted an edit for your answer so that it displays as properly formatted code with the markdown language.
$endgroup$
– I_Play_With_Data
2 days ago
add a comment |
$begingroup$
df['Served'] = (df.iloc[:, 1:] == 1).idxmax(1)
New contributor
$endgroup$
$begingroup$
Welcome to the site! I have submitted an edit for your answer so that it displays as properly formatted code with the markdown language.
$endgroup$
– I_Play_With_Data
2 days ago
add a comment |
$begingroup$
df['Served'] = (df.iloc[:, 1:] == 1).idxmax(1)
New contributor
$endgroup$
df['Served'] = (df.iloc[:, 1:] == 1).idxmax(1)
New contributor
edited 2 days ago
I_Play_With_Data
1,214532
1,214532
New contributor
answered 2 days ago
Gene XuGene Xu
111
111
New contributor
New contributor
$begingroup$
Welcome to the site! I have submitted an edit for your answer so that it displays as properly formatted code with the markdown language.
$endgroup$
– I_Play_With_Data
2 days ago
add a comment |
$begingroup$
Welcome to the site! I have submitted an edit for your answer so that it displays as properly formatted code with the markdown language.
$endgroup$
– I_Play_With_Data
2 days ago
$begingroup$
Welcome to the site! I have submitted an edit for your answer so that it displays as properly formatted code with the markdown language.
$endgroup$
– I_Play_With_Data
2 days ago
$begingroup$
Welcome to the site! I have submitted an edit for your answer so that it displays as properly formatted code with the markdown language.
$endgroup$
– I_Play_With_Data
2 days ago
add a comment |
Thanks for contributing an answer to Data Science Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f12099%2ftechnical-name-for-this-data-wrangling-process-multiple-columns-into-multi-fact%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
$begingroup$
The answer given is right, but 'wide format to long format' might be even more specific, also, I recommend reshape2 instead of reshape, reshape is, as I understand it, underdocumented
$endgroup$
– Shape
Jun 8 '16 at 22:42
1
$begingroup$
@Shape Do you know of any more synonyms of "reshape"? It shocks me that when I look for 'reshape' and Weka or Rapidminer I get nothing on google.
$endgroup$
– thanks_in_advance
Jun 9 '16 at 6:08
1
$begingroup$
It's "normalization" in database theory.
$endgroup$
– Diego
Jun 9 '16 at 8:55