Dwaipayan Dasgupta
2012-Apr-24 15:38 UTC
[R] Splitting data into test and train (80:20) kepping attributes similar
Hi, I am trying to do some predictive modeling around attrition and want to split the dataset into test and train (80:20) and keep the ratio of attritees:non attrites same. In my dataset the attrition indicator is coded as 0(for non-attritees) and 1 (for attritees) and I want to keep the ratio of 0's to 1 similar. I apologize for this trivial question but this is my second week with R. Thanks, Doy American Express made the following annotations on Tue Apr 24 2012 08:38:50 ****************************************************************************** "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." American Express a ajouté le commentaire suivant le Tue Apr 24 2012 08:38:50 Ce courrier et toute pièce jointe qu'il contient sont réservés au seul destinataire indiqué et peuvent renfermer des renseignements confidentiels et privilégiés. Si vous n'êtes pas le destinataire prévu, toute divulgation, duplication, utilisation ou distribution du courrier ou de toute pièce jointe est interdite. Si vous avez reçu cette communication par erreur, veuillez nous en aviser par courrier et détruire immédiatement le courrier et les pièces jointes. Merci. ****************************************************************************** ------------------------------------------------------------------------------- [[alternative HTML version deleted]]
Dwaipayan Dasgupta
2012-Apr-25 10:39 UTC
[R] Splitting data into test and train (80:20) kepping attributes similar
Hi, Could someone help me with this please , im trying to use Y = Attrition_data[,1] # extract labels from the data msk = sample.split (Y, SplitRatio=3/4) table(Y,msk) to do the splitting but it keeps throwing up and error Error: could not find function "sample.split" Could you please help Thanks in advance doy -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Dwaipayan Dasgupta Sent: Tuesday, April 24, 2012 9:08 PM To: r-help at r-project.org Subject: [R] Splitting data into test and train (80:20) kepping attributes similar Hi, I am trying to do some predictive modeling around attrition and want to split the dataset into test and train (80:20) and keep the ratio of attritees:non attrites same. In my dataset the attrition indicator is coded as 0(for non-attritees) and 1 (for attritees) and I want to keep the ratio of 0's to 1 similar. I apologize for this trivial question but this is my second week with R. Thanks, Doy American Express made the following annotations on Tue Apr 24 2012 08:38:50 ****************************************************************************** "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." American Express a ajout? le commentaire suivant le Tue Apr 24 2012 08:38:50 Ce courrier et toute pi?ce jointe qu'il contient sont r?serv?s au seul destinataire indiqu? et peuvent renfermer des renseignements confidentiels et privil?gi?s. Si vous n'?tes pas le destinataire pr?vu, toute divulgation, duplication, utilisation ou distribution du courrier ou de toute pi?ce jointe est interdite. Si vous avez re?u cette communication par erreur, veuillez nous en aviser par courrier et d?truire imm?diatement le courrier et les pi?ces jointes. Merci. ****************************************************************************** ------------------------------------------------------------------------------- [[alternative HTML version deleted]] American Express made the following annotations on Wed Apr 25 2012 03:39:08 ****************************************************************************** "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." American Express a ajout? le commentaire suivant le Wed Apr 25 2012 03:39:08 Ce courrier et toute pi?ce jointe qu'il contient sont r?serv?s au seul destinataire indiqu? et peuvent renfermer des renseignements confidentiels et privil?gi?s. Si vous n'?tes pas le destinataire pr?vu, toute divulgation, duplication, utilisation ou distribution du courrier ou de toute pi?ce jointe est interdite. Si vous avez re?u cette communication par erreur, veuillez nous en aviser par courrier et d?truire imm?diatement le courrier et les pi?ces jointes. Merci. ****************************************************************************** -------------------------------------------------------------------------------