[R] Extract from a text file

Ulrik Stervbo ulrik.stervbo at gmail.com
Tue May 31 06:21:21 CEST 2016


Hi Val,

Take a kook at read.table. If for some reason the file dosen't have the
same separator between the columns you can use strsplit after loading the
file.

This might helpyou along getting data into R:
http://www.statmethods.net/input/importingdata.html

Best

On Tue, 31 May 2016, 02:15 Val, <valkremk at gmail.com> wrote:

> Hi all,
>
> I have a messy text file and from this text file I want extract some
> information
> here is the text file (out.txt).  One record has tow lines. The mean comes
> in the first line and the SE of the mean is on the second line. Here is the
> sample of the data.
>
> Mean of weight  group 1, SE of mean  :  72.289037489555276
>  11.512956539215610
> Average weight of group 2, SE of Mean :  83.940053900595013
>   10.198495690144522
> group 3 mean , SE of Mean     :                78.310441258245469
>  13.015876679555
> Mean of weight of group 4, SE of Mean               : 76.967516495101669
>  12.1254882985
>
> I want produce the following  table. How do i read it first and then
> produce a
>
>
> Gr1  72.289037489555276   11.512956539215610
> Gr2  83.940053900595013   10.198495690144522
> Gr3  78.310441258245469   13.015876679555
> Gr4  76.967516495101669   12.1254882985
>
>
> Thank you in advance
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list