Hi All,

I would like to input a .txt file by using read.table()

the file data.txt:

Name    ID
IMAGE:1000031    suid=115221
IMAGE:1000208    51265
IMAGE:1000334    64770
IMAGE:1000365    suid=99969
IMAGE:1000500    55421
IMAGE:1000875    64770
IMAGE:1000892    399655
IMAGE:1000942    suid=112379
IMAGE:1007141    5001
IMAGE:1007150    55
IMAGE:1007164    suid=117508
IMAGE:1007167    suid=102504

when I use
> data <- read.table("data.txt", sep="\t", header = TRUE)
> data
            Name          ID
1  IMAGE:1000031 suid=115221
2  IMAGE:1000208       51265
3  IMAGE:1000334       64770
4  IMAGE:1000365  suid=99969
5  IMAGE:1000500       55421
6  IMAGE:1000875       64770
7  IMAGE:1000892      399655
8  IMAGE:1000942 suid=112379
9  IMAGE:1007141        5001
10 IMAGE:1007150          55
11 IMAGE:1007164 suid=117508
12 IMAGE:1007167 suid=102504


it seems perfectly fine, however, when I get access to data[1,1] ...

> data[1,1]
[1] IMAGE:1000031
12 Levels: IMAGE:1000031 IMAGE:1000208 IMAGE:1000334 ... IMAGE:1007167

How could I get rid of all the Levels in ALL of the entries.

It bothers me since when I have to assign certain values from data to a new
matrix b by:
> b <- matrix(0,1,2)
> b[1,1] <- data[1,1]
> b[1,1]
1

b[1,1] is 1 instead of the value IMAGE:1000031 I want


Greatly Appreciate for any help
Thanks,
Alex-

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to