Try this:

x <- readLines('clipboard')
newx <- as.numeric(x[setdiff(seq(length(x)), grep("^#", x))])
comment(newx) <- grep("^#", x, value = TRUE)
newx
comment(newx)

On Thu, Aug 28, 2008 at 12:41 PM, Dani Valverde <daniel.valverde@uab.cat>wrote:

> Hello,
> I have a text file with this structure:
>
> # File created = Thursday, August 28, 2008 3:33:02 PM GMT
> # Data set = 373  2  1  C:\Bruker\TOPSPIN  GABRMN
> # Spectral Region:
> # LEFT = 4.5 ppm. RIGHT = 0.5 ppm.
> #
> # SIZE = 13111 ( = number of points)
> #
> # In the following ordering is from the 'left' to the 'right' limits!
> # Lines beginning with '#' must be considered as comment lines.
> #
> 1628.40625
> 1628.40625
> 1964.40625
> 2242.0625
> 2533.5
> 2937.90625
> 3448.0
> 3923.96875
>
> Is it possible to read it with R, something like scan() but keeping the
> structure?
> Best,
>
> Dani
>
> --
> Daniel Valverde Saubí
>
> Grup de Biologia Molecular de Llevats
> Facultat de Veterinària de la Universitat Autònoma de Barcelona
> Edifici V, Campus UAB
> 08193 Cerdanyola del Vallès- SPAIN
>
> Centro de Investigación Biomédica en Red
> en Bioingeniería, Biomateriales y
> Nanomedicina (CIBER-BBN)
>
> Grup d'Aplicacions Biomèdiques de la RMN
> Facultat de Biociències
> Universitat Autònoma de Barcelona
> Edifici Cs, Campus UAB
> 08193 Cerdanyola del Vallès- SPAIN
> +34 93 5814126
>
> ______________________________________________
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]

