0

I have a data.frame (table_2) of 12531 rows and 92 cols and I would like to load it into MySQL using 'RMySQL' package, so...

dbWriteTable(con,'DB.table_2',table_2,row.names=F)

Checking the output in MySQL, I see that the table has 3 rows more, with all fields missing (NULL):

check1 <- dbGetQuery(con,'select * from DB.table_2')  # 12534 rows
check2 <- check1[is.na(check1$row_1),] # 3 obs

The only way I found to solve this problem is filtering the table:

dbGetQuery(con,'create table DB.table_3 select * from
                DB.table_2 where row_1 is not NULL')
table_3 <- dbGetQuery(con,'select * from DB.table_3')  # 12531 rows

Does somebody know if there is a better way to do it and the reason of this problem?

Many thanks for your help. Christian.

4

0 回答 0