[R] dbApply and data.frame
Thomas W Blackwell
tblackw at umich.edu
Thu Jul 17 22:09:07 CEST 2003
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))
- tom blackwell - u michigan medical school - ann arbor -
On Thu, 17 Jul 2003, Jesper Runge Madsen wrote:
> Hallo again
>
> I now succeeded in using dbApply on my data and I can convert it into a
> data.frame. But as Peter Dalgaard pointed out I his answer to my earlier
> question (Re: [R] list to data frame, 17.07.2003) I get one row and 10000
> columns instead of what I want two columns and 10000 rows when I convert
> the list that dbApply returns to a Data frame.
>
> The list I want to convert looks like this
>
> structure(list("10000" = 123.85, "100003" = 59.7, "100004" = 61.5,
> "100005" = 61.525, "10001" = 124.525, "100016" = 64.93848,
> "100018" = 64.55, "10002" = 125.435, "100020" = 61.5714,
> .
> .
> .
> "9998" = 124.75, "99987" = 58.86503, "99989" = 61.93, "9999" = 123.8625,
>
> "99993" = 59.850025, "99995" = 36.853585), .Names = c("10000",
> "100003", "100004", "100005", "10001", "100016", "100018", "10002",
> .
> .
> "99962", "9997", "99973", "99978", "9998", "99987", "99989",
> "9999", "99993", "99995"))
>
>
> what I get when I use as.data.frame(fraktil) is as said
>
>
> X10000 X100003 X100004
> 123.85 59.7 61,5
>
> I have tried this
> fraktil.df <-
> data.frame(LinieID=names(fraktil),"quantile_85"=unlist(fraktil))
> but when I do this R shutsdown with no warning( R 1071, on a winXP system)
> the same happens when I try write.table or dbWriteTable(con, "fraktil",
> fraktil)
> What I would like to end up with is a table like this
>
> LinieID quantile_85
> 100005 61.525
> 10001 124.525
> 100016 64.93848
> 100018 64.55
> 10002 125.435
> 100020 61.5714
> . .
> . .
> . .
>
> Now at last my question J, is there a way to make my list/data frame into
> the table shown above. And does anybody know why R is crashing.
>
> Jesper Runge Madsen
> Ph.D.
> Trafikforskningsgruppen
> Institut for Samfundsudvikling og Planlægning
> Aalborg Universitet
> runge at plan.auc.dk
> Tel: 9635 9800
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
More information about the R-help
mailing list