Well, it throws an error, because there is no such function in default R. A bit 
of googling showed it might be the one in the caTools package.

execute this:
install.packages("caTools")
library(caTools)

before executing your code


Am 25.04.2012 um 12:39 schrieb Dwaipayan Dasgupta:

> 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-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> Behalf Of Dwaipayan Dasgupta
> Sent: Tuesday, April 24, 2012 9:08 PM
> To: r-help@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. 
> 
> ******************************************************************************
> -------------------------------------------------------------------------------
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to