I don't have much experience with SQL, but I suspect that it is something like CHARACTER or NUMERIC... maybe.
On Tue, Oct 12, 2010 at 7:47 PM, Nilza BARROS <nilzabar...@gmail.com> wrote: > Dear Rusers, > > I am trying to feed my database with data from a file. > > But since my file (2010101000.txt) there`s no headers I am facing problem > because the > result data.frame is not separated my columns. > > How could I set variables names for each columns in *dbWriteTable*? I have > tried the command below but I don`t know how to fill the *field.type*option. > > > dbWriteTable(con, "b20101010", "./2010101000.txt", overwrite = T, sep = > "\t",row.names=c("V01", "V02", "V03", "V04", "V05", "V06"," V07","V08", > "V09", "V10", "V11", "V12", "V13", "V14"),field.type=????) > > ===Below what I have been used. I need to know how to set the column names > to xx (my dataframe). > >> drv=dbDriver("MySQL") >> con <- dbConnect(drv,dbname='buoy',user="xx",password="xxx") >> dbWriteTable(con, "b20101010", "./2010101000.txt", overwrite = T, sep = > "\t", head = F) > [1] TRUE >> >> *xx*<- dbGetQuery(con, "SELECT * FROM b20101010 ") >> xx > > * V1 > *1 00859 2010 10 10 00 50 -41.51 6.83 -9999 1016 -9999 -9999.0 > -9999.0 -9999.0 > 2 00859 2010 10 09 22 50 -41.51 6.81 -9999 1015 -9999 -9999.0 -9999.0 > -9999.0 > 3 00707 2010 10 09 23 00 -34.04 -37.63 -9999 1025 -9999 -9999.0 -9999.0 > -9999.0 > 4 00005 2010 10 09 23 00 -34.69 -18.89 -9999 1017 207 7.2 297.1 > -9999.0 > 5 00859 2010 10 09 23 50 -41.51 6.81 -9999 1015 -9999 -9999.0 -9999.0 > -9999.0 > 6 00005 2010 10 09 23 00 -34.69 -18.89 -9999 1017 207 7.2 297.1 > -9999.0 > 7 00617 2010 10 09 23 20 -18.43 -23.09 -9999 1023 -9999 -9999.0 -9999.0 > -9999.0 > 8 00707 2010 10 10 00 00 -34.03 -37.62 -9999 1025 -9999 -9999.0 -9999.0 > -9999.0 > 9 00707 2010 10 10 01 00 -34.03 -37.62 -9999 1025 -9999 -9999.0 -9999.0 > -9999.0 > *> length(xx) > [1] 1 > * > -- > Abraço, > Nilza Barros > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help@r-project.org 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. > > -- Stephen Sefick ____________________________________ | Auburn University | | Department of Biological Sciences | | 331 Funchess Hall | | Auburn, Alabama | | 36849 | |___________________________________| | sas0...@auburn.edu | | http://www.auburn.edu/~sas0025 | |___________________________________| Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis "A big computer, a complex algorithm and a long time does not equal science." -Robert Gentleman ______________________________________________ R-help@r-project.org 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.