On Mon, May 9, 2011 at 12:59 PM, Nilza BARROS <nilzabar...@gmail.com> wrote: > Hi, Thanks for your attentio. > > I have the data frame below: > ==== >> head(Alldados) > Station_NO date1 T_2M TMAX_2M TMIN_2M TD_2M PS FF_10M DD_10M > 1 820420 110429/1200 22.5 NULL 22.4 22.2 NULL 0 0 > 2 820980 110429/1200 26.9 NULL 23.4 24.1 1010.2 2.91 360 > 3 821130 110429/1200 24.3 NULL 23.3 23.7 NULL 1.94 230 > 4 821410 110429/1200 24.4 NULL 23.7 24.2 1011.8 2.91 270 > 5 821450 110429/1200 28.2 NULL 21.1 25.8 1008.8 0 0 > 6 821810 110429/1200 23.3 NULL 22.8 22.9 1001.6 0 0 > TOT_PRCP CLCL date2 > 1 84.00 NULL 2011042912 > 2 2.00 NULL 2011042912 > 3 3.00 NULL 2011042912 > 4 12.00 NULL 2011042912 > 5 6.00 NULL 2011042912 > 6 38.00 NULL 2011042912 > ==== > Now each line will feed my database. So I need to format each line like > below: > > =================================== > [1] "INSERT INTO OBS > (date,T_2M,TMAX_2M,TMIN_2M,TD_2M,PS,FF_10M,DD_10M,TOT_PRCP,CLCL,Station_NO) > VALUES (2011042912, 22.50, NA, 22.40,22.20, NA, 0.00, 0.00,36.00, > NA,820420)" > [2] "INSERT INTO OBS > (date,T_2M,TMAX_2M,TMIN_2M,TD_2M,PS,FF_10M,DD_10M,TOT_PRCP,CLCL,Station_NO) > VALUES (2011042912, 26.90, NA, 23.40,24.10,1010.20, 2.91,360.00,16.00, > NA,820980)" > [3] "INSERT INTO OBS > (date,T_2M,TMAX_2M,TMIN_2M,TD_2M,PS,FF_10M,DD_10M,TOT_PRCP,CLCL,Station_NO) > VALUES (2011042912, 24.30, NA, 23.30,23.70, NA, 1.94,230.00,19.00, > NA,821130)" > [4] "INSERT INTO OBS > (date,T_2M,TMAX_2M,TMIN_2M,TD_2M,PS,FF_10M,DD_10M,TOT_PRCP,CLCL,Station_NO) > VALUES (2011042912, 24.40, NA, 23.70,24.20,1011.80, 2.91,270.00,12.00, > NA,821410)" > [5] "INSERT INTO OBS > (date,T_2M,TMAX_2M,TMIN_2M,TD_2M,PS,FF_10M,DD_10M,TOT_PRCP,CLCL,Station_NO) > VALUES (2011042912, 28.20, NA, 21.10,25.80,1008.80, 0.00, 0.00,31.00, > NA,821450)" > [6] "INSERT INTO OBS > (date,T_2M,TMAX_2M,TMIN_2M,TD_2M,PS,FF_10M,DD_10M,TOT_PRCP,CLCL,Station_NO) > VALUES (2011042912, 23.30, NA, 22.80,22.90,1001.60, 0.00, 0.00,24.00, > NA,821810)" > [7] "INSERT INTO OBS > =============== >
Please 1. reduce Allados to a smaller number of columns and rows. Say 10 rows and 3 columns such that it still exhibits the problem and then show the result of dput: dput(smallDF) 2. provide the R code that you would use with smallDF 3. explain what the problem is and how that differs from what you expect. -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ 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.