Re: [R] Two last questions: about output

2008-10-16 Thread Gabor Grothendieck
Please read the last line of every message to r-help and provide reproducible code. On Thu, Oct 16, 2008 at 12:44 AM, Ted Byers <[EMAIL PROTECTED]> wrote: > Thanks Gabor, > > To be clear, would something like testframe$est[[i]] <- fp$estimate be > valid within my loop, as in (assuming I created te

Re: [R] Two last questions: about output

2008-10-15 Thread Ted Byers
Thanks Gabor, To be clear, would something like testframe$est[[i]] <- fp$estimate be valid within my loop, as in (assuming I created testframe before the loop): for (i in 1:length(V4) ) { x = read.csv(as.character(V4[[i]]), header = FALSE, na.strings=""); y = x[,1]; fp = fitdistr(y,"expo

Re: [R] Two last questions: about output

2008-10-15 Thread Gabor Grothendieck
testframe$newvar <- ...whatever... (or see ?transform for another way) adds a new column to the data frame. The table does not have to pre-exist in your MySQL database and you don't need a create statement; however, if the table does pre-exist the columns of your data frame and those of the datab

Re: [R] Two last questions: about output

2008-10-15 Thread Ted Byers
Thanks Gabor, I get how to make a frame using existing vectors. In my example, the following puts my first three columns into a frame (and displays it: > testframe <- data.frame(mid=V1,year=V2,week=V3) > testframe mid year week 1 251 2008 18 2 251 2008 19 3 251 2008 20 4 251 2008

Re: [R] Two last questions: about output

2008-10-15 Thread Gabor Grothendieck
Put the data in an R data frame and use dbWriteTable() to write it to your MySQL database directly. On Wed, Oct 15, 2008 at 9:34 PM, Ted Byers <[EMAIL PROTECTED]> wrote: > > Here is my little scriptlet: > > optdata = > read.csv("K:\\MerchantData\\RiskModel\\AutomatedRiskModel\\soptions.dat", > hea

[R] Two last questions: about output

2008-10-15 Thread Ted Byers
Here is my little scriptlet: optdata = read.csv("K:\\MerchantData\\RiskModel\\AutomatedRiskModel\\soptions.dat", header = FALSE, na.strings="") attach(optdata) library(MASS) setwd("K:\\MerchantData\\RiskModel\\AutomatedRiskModel") for (i in 1:length(V4) ) { x = read.csv(as.character(V4[[i]]),