[R] dbApply and data.frame

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Jul 17 23:28:58 CEST 2003


Thomas W Blackwell <tblackw at umich.edu> writes:

> Runge  -
> 
> I haven't tried it out, but half a guess says that R might not like
> using underscore in a variable name.  Please try exactly the same
> command without quotes and without the underscore:
> 
> fraktil.df <- data.frame(LinieID=as.numeric(names(fraktil)),
> 	 	quantile85=unlist(fraktil))


Should work when quoted, so I wouldn't have too high hopes that it
works (but it's worth a try of course). 

The same thing works with synthetic data:

> l <- as.list(rnorm(200000))
> names(l) <- 1:200000
> fraktil <- l
> fraktil.df <- data.frame(LinieID=as.numeric(names(fraktil)),"quantile_85"=unlist(fraktil))
> fraktil.df[1:20,]
   LinieID quantile.85
1        1  0.78609143
2        2  1.16852825
3        3  1.11639102
4        4 -1.09446630
5        5  0.95239745
6        6 -1.15613682
7        7  1.04672917
8        8 -1.66155659
9        9 -0.47110949
10      10  0.08956315
11      11 -0.58068630
12      12 -1.15674753
13      13  1.70977126
14      14  0.52023438
15      15 -1.99154007
16      16  2.11717771
17      17 -0.18951885
18      18  0.19108247
19      19  0.39874107
20      20  0.97474058

(You actually need to add check.names=FALSE to prevent it from
removing the underscore automatically).

I.e. R is not *supposed* to crash, so either there is a platform
dependency  or (more likely) it is triggered by an earlier memory
corruption in dbApply() or the database backend. What kind of machine
is this happening on? Would it be possible for you to run under the
debugger so that we could get a bit more information.
 
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list