# Problems with importing a .txt file

I have some problems with importing a .txt file as a table. This is the file. I tried importing it with

data = Import["data.txt", "Data"]


I want to access single values, but it doesn't work with my import. I can't access data[[2, 1]] for example to get the first value in data[[2]] and so on. Any ideas?

-

xxx = Import["C:\\Users\\Rasher\\Downloads\\data.txt", "Data"];
zzz = xxx // StringSplit;
zzz[[2, 2]]


Gives 774...

You need to decide how / where to "split" or do other operations, since this is basically a bulk text file, e.g., split at line-breaks, etc. Read the documentation on StringSplit and ancillary text manipulation functions, once you've imported it these will let you massage it into the desired MMA list/array structure.

With just the above, row 1 of zzz is what appear to be the column headings, so zzz[[1,n]] gets you the n'th one. Row 2 to ... are the rows, with the first entry the row name, e.g, zzz[[2,1]] gets the name of the first row under headings, zzz[[2,2]] the first row entry, etc.

-
Ahh StringSplit, of course. Works fine now..thanks :) –  holistic Feb 27 '14 at 11:59

Here is another way that does it for you in one go:

data = ReadList["https://dl.dropboxusercontent.com/u/19921198/data.txt", Word,
RecordLists -> True];


So that:

data[[2, 2]]


gives 774

-