FloRi
FloRi

Reputation: 1

read.table() does not load all rows

Got another Problem: When using the read.table() function R does not get all rows. I already checked the data and it is like R just cuts the rows.

I write the table like this:

write.table(MV2015, file = "D:\\project\\data\\MV2015.txt", quote = TRUE, sep = "\t", row.names = FALSE)

And read it:

MVtest <- read.table("D:/project/data/MV2015.txt", header= TRUE, quote = "", sep = "\t",  comment.char = "", fill = TRUE, na.strings = " ")

And i get These dimensions:

dim(MV2015) [1] 487485 30

dim(MVtest) [1] 229197 30

I already tried countless arguments in the function but always get the same outcome.

If You Need some more Information on my code, let me know.

Data:

>     APIOS PREIS RABATT TAM   DIVERSE BROKERNUMMER STATISTIKCODE AKFIR AKVN1       AKRSI   AKVN2    AKKDN                          AKN11 APFZG      APRCD
>1              0      0   0 -42840.00     10275632           ALL    10    10 01000004673 9247114 10275632 company1        4WHEEL-LM4
>2              0      0   0 -27150.44     18891001           ALL    10    10 01000004853 9247294 18891001 company2                               **DIVERS
>3              0      0   0 -14093.00     10278590           ALL    10    10 01000005031 9247472 10278590 company3                **DIVERS
>4              0      0   0 -14055.89     10278590           ALL    10    10 01000004991 9247432 10278590 company3                **DIVERS
>5              0      0   0 -14025.42     10278590           ALL    10    10 01000004873 9247314 10278590 company3                **DIVERS
>  APACS APBGR MIETTAGE MIETSTUNDEN APIOD APIID APFZA           APTBH                          APTBZ APCSR CIST      KAT       Region Gesamt STATORT
>1          XL        0           0     0     0                                                               0      RAV Überregional   <NA>    <NA>
>2          P         0           0     0     0                                                               0 **DIVERS Überregional   <NA>    <NA>
>3          P         0           0     0     0                                                               0 **DIVERS Überregional   <NA>    <NA>
>4          P         0           0     0     0                                                               0 **DIVERS Überregional   <NA>    <NA>
>5          P         0           0     0     0                                                               0 **DIVERS Überregional   <NA>    <NA>

Upvotes: 0

Views: 666

Answers (1)

Veera
Veera

Reputation: 869

MV2015$serial = c(1:nrow(MV2015))

write.table(MV2015,file = "MVtest", ....)
MVtest = read.table("MVtest"...)

missedOnes = MV2015[!MV2015$serial%in%MVtest$serial,]

Inspect the missedOnes

Upvotes: 2

Related Questions