On 25/04/07, Abi Ghanem josephine <josephine.abighanem@ibpc.fr> wrote:
>
> Hi,
> i have a problem in assigning 2 conditions to grep()  ,
> my data look like this:
> DA 24 N7 Rad= 3.4 20 Sac= 0.93 Acc= 4.76
> DA 24 N7 Rad= 3.4 14 Sac= 0.65 Acc= 3.33
> DA 24 N7 Rad= 3.4  3 Sac= 0.14 Acc= 0.71
> DA 24 N7 Rad= 3.4 11 Sac= 0.51 Acc= 2.62
> DG 23 N7 Rad= 3.4  8 Sac= 0.37 Acc= 1.91
> DG 23 N7 Rad= 3.4  5 Sac= 0.23 Acc= 1.19
> DG 23 N7 Rad= 3.4  0 Sac= 0.00 Acc= 0.00
> DG 23 N7 Rad= 3.4  3 Sac= 0.14 Acc= 0.71
> DG 23 O6 Rad= 3.3  0 Sac= 0.00 Acc=  0.00
> DG 23 O6 Rad= 3.3  1 Sac= 0.04 Acc=  0.22
> DG 23 O6 Rad= 3.3  0 Sac= 0.00 Acc=  0.00
> DG 23 O6 Rad= 3.3  0 Sac= 0.00 Acc=  0.00
> (it's a data.frame)
>
> at first i wanted all the line begining with A 24:
> data[grep("^24", data$V2)]
> this works
> and than i wanted to exctract all the lines with G23 N7,
> neither the column 23 and the column N7 are unique
> so i tried this
> data[grep("^23*N7", data),]
> but doesn't work



how about
data[ intersect( grep("^24", data$V2), grep("N7",data$V3) ) , ]
?

C.

	[[alternative HTML version deleted]]

