[R] Divide the data into sub data on a particular condition
arun
smartpink111 at yahoo.com
Sat Aug 24 17:44:16 CEST 2013
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
More information about the R-help
mailing list