Loading...
X

R – reading tabular data files

commandline session

> dfrm <- read.table("first.txt",sep="-")
> print(dfrm
dfrm
> print(dfrm)
    V1      V2
1 Name Jeffrin
2  Age      35
3  Sex    Male
> dfrm <- read.table("first.txt",sep=" ")
> print(dfrm)
            V1
1 Name-Jeffrin
2       Age-35
3     Sex-Male
> dfrm <- read.table("first.txt",sep=".")
> print(dfrm)
            V1
1 Name-Jeffrin
2       Age-35
3     Sex-Male
> class(dfrm$V1)
[1] "factor"
> class(dfrm$V1)
[1] "factor"
> class(dfrm$V2)
[1] "NULL"
> class(dfrm$V3)
[1] "NULL"
>

$ 4.2.20 6 506---> cat first.txt
Name-Jeffrin
Age-35
Sex-Male
$ 4.2.20 7 507--->

Leave Your Observation

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2009,  2010,  2011,  2012,  2013,  2014     BeautifulWork Project    e-mail:  ahiliation@yahoo.co.in
BeautifulWork Project comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.