thank you so much :)
On Sun, Aug 25, 2013 at 7:48 AM, arun kirshna [via R] < ml-node+s789695n4674466...@n4.nabble.com> wrote: > > > Hi, > Try this: > > sapply(lst1,function(x) with(x,cor(CF,OSA))) > # 2231 2232 2233 > #-0.9607689 -1.0000000 0.9973233 > #or > library(plyr) > ddply(dat1,.(BaseProd),summarize,Cor=cor(CF,OSA)) > # BaseProd Cor > #1 2231 -0.9607689 > #2 2232 -1.0000000 > #3 2233 0.9973233 > > #or > library(data.table) > dt1<- data.table(dat1) > dt1[,cor(CF,OSA),by=BaseProd] > # BaseProd V1 > #1: 2231 -0.9607689 > #2: 2232 -1.0000000 > #3: 2233 0.9973233 > > > A.K. > > > > I forget to add one more thing...sorry for that.. > after dividing the data, I have to find the correlation between CF > and OSA for each base product....Please tell me now how to do this thing > > > ----- Original Message ----- > From: arun <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4674466&i=0>> > > To: R help <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4674466&i=1>> > > Cc: > Sent: Saturday, August 24, 2013 11:44 AM > Subject: Re: Divide the data into sub data on a particular condition > > Hi, > Use ?split() > #dat1 is the dataset: > lst1<- split(dat1,dat1$BaseProd) > lst1 > #$`2231` > # BaseProd CF OSA > #1 2231 0.5 0.7 > #2 2231 0.8 0.6 > #3 2231 0.4 0.8 > # > #$`2232` > # BaseProd CF OSA > #4 2232 1 2 > #5 2232 3 1 > # > #$`2233` > # BaseProd CF OSA > #6 2233 0.9 0.5 > #7 2233 0.7 0.5 > #8 2233 4.0 5.0 > #9 2233 5.0 7.0 > > > lst1[[1]] > # BaseProd CF OSA > #1 2231 0.5 0.7 > #2 2231 0.8 0.6 > #3 2231 0.4 0.8 > A.K. > > > > Hi, > I am totally new to R. I am facing the following problem: > I have data of the following form > > BaseProd CF OSA > 2231 0.5 0.7 > 2231 0.8 0.6 > 2231 0.4 0.8 > 2232 1 2 > 2232 3 1 > 2233 0.9 0.5 > 2233 0.7 0.5 > 2233 4 5 > 2233 5 7 > > I want to divide the data so that the data get divided on the basis of > base product. > like: > data1 > > BaseProd CF OSA > 2231 0.5 0.7 > 2231 0.8 0.6 > 2231 0.4 0.8 > > data2 > BaseProd CF OSA > 2232 1 2 > 2232 3 1 > > data3 > BaseProd CF OSA > 2233 0.9 0.5 > 2233 0.7 0.5 > 2233 4 5 > 2233 5 7 > > Please help me ... Its very important and please reply ASAP > > ______________________________________________ > [hidden email] <http://user/SendEmail.jtp?type=node&node=4674466&i=2>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. > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://r.789695.n4.nabble.com/Divide-the-data-into-sub-data-on-a-particular-condition-tp4674445p4674466.html > To unsubscribe from Divide the data into sub data on a particular > condition, click > here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4674445&code=cmFpc2hpbHBhLmJodUBnbWFpbC5jb218NDY3NDQ0NXwxOTAyOTIzNTU5> > . > NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- Shilpa Rai MSc.(2011-2013) Applied Statistics and Informatics Indian Institute of Technology,Bombay -- View this message in context: http://r.789695.n4.nabble.com/Divide-the-data-into-sub-data-on-a-particular-condition-tp4674445p4674484.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] ______________________________________________ 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.