Tuesday, 3 September 2013

R read only specific row of textfile and store them in data.frame

R read only specific row of textfile and store them in data.frame

I have the following problem. There is a textfile that I want to import
into R. It looks like this:
# Below, those lines that start with a minus sign and an l (-l)
# define loci, while those that start with a minus sign and an i (-i)
# define epistatic interactions between the loci previously defined.
# The loci must be defined before the interactions can be defined.
# For some experimental designs, some interactions will be ignored.
#
-start model
#
# Here is the data on the QTLS...
#
-t 3 is the number of traits
#
#
-k 1
# for trait -number 1
#
# # ..Chrom..Markr. .RecombiL. .RecombiR. .Additive.
.Dominance
-l 1 2 19 0.0823 0.0028 1.1712
0.0000
#
# QTL1 QTL2 Type Value
#
#
#
-k 1
# for trait -number 2
#
# # ..Chrom..Markr. .RecombiL. .RecombiR. .Additive.
.Dominance
-l 1 2 14 0.0309 0.0564 0.4635
0.0000
#
# QTL1 QTL2 Type Value
#
#
#
-k 1
# for trait -number 3
#
# # ..Chrom..Markr. .RecombiL. .RecombiR. .Additive.
.Dominance
-l 1 15 61 0.0782 0.0261 0.1200
0.0000
#
# QTL1 QTL2 Type Value
#
#
#
#End of this block of information
#
-end model
#
Now I want to read the rows that begins with -l and save them in a
data.frame. Does anybody know a way to achieve this? Thanks.

No comments:

Post a Comment