Reputation: 4239
I tried to read in data into R. The original data in R looks like this(2 columns):
0001694304038 0001307304135
53693819142794292671008449081562285178 35902638881091172349429496704016716029
0001694315761 0002347472709
However, everytime I read this into RStudio, the data becomes
V1 V2
1 1.694304e+09 1.307304e+09
2 5.369382e+37 3.590264e+37
3 1.694316e+09 2.347473e+09
How can I make R read in the data like what they are in the original data ? (I would them to appear in RStudio in the form that I have in my original data file)
To elaborate, Column 1 and 2 are IP addresses and I am trying to obtain an igraph. It will make my life easy if I can keep the IP address as it is in the original data.
Upvotes: 0
Views: 207
Reputation: 1452
Read your data file as strings, not integers. This will depend on which input method you are using. Using, e.g., read.table
, you can set colClasses
as follows:
dat = read.table(file="file.dat", header=F, colClasses=c("character", "character"))
Upvotes: 2
Reputation: 57686
Use the colClasses
argument.
read.table(*, colClasses=c("character", "character"))
Upvotes: 1