# The filename is Test.r chinook <- read.table("C:/Documents and Settings/Owner/Desktop/R-Software/chinook.txt",header=T,sep="\t") chinook$IDDate <- as.Date(chinook$IDDate, "%m/%d/%Y") qplot(IDDate,Fry, data=chinook, geom="line")
I try to call it like this: Sub Testing() Call RInterface.StartRServer Call RInterface.RunRFile("C:\Documents and Settings\Owner\Desktop\R-Software\Test.r") End Sub --- Erich Neuwirth <[EMAIL PROTECTED]> wrote: > show us your read.table command. > does it have the fiull path with the right kind of > backlslahes > or slashes? > > Felipe Carrillo wrote: > > Erich: > > The code below has a read.table(.....)statement > and is > > ignored by R. Can you point out what am I doing > wrong > > or if I need additional code? Thanks > > > > Sub Testing() > > Call RInterface.StartRServer > > Call RInterface.RunRFile("C:\Documents and > > Settings\Owner\Desktop\R-Software\Test.r") > > End Sub > > > > > > > > --- Erich Neuwirth <[EMAIL PROTECTED]> > > wrote: > > > >> The script can use all R functions > >> for reading data, > >> load (for workspaces) > >> or read.table or > >> read.spss (from package foreign) > >> > >> > >> Felipe Carrillo wrote: > >>> Dwayne: > >>> Thanks a lot for your help,it works fine but for > >> some > >>> reason when I try to import a dataset within my > >> script > >>> R doesn't execute. It works if I include > something > >>> like this in my script: > >>> set.seed(101) > >>> gender <- > >>> factor(x=c(rep("Male",30),rep("Female",70))) > >>> age.class <- > >>> > > > factor(x=rep(c("Y","M","O","Y","M","O"),c(5,15,10,10,40,20)), > >>> levels=c("Y","M","O")) > >>> hts <- c(rnorm(30,70,6),rnorm(70,63,4)) > >>> wts <- > >>> > > > c(rnorm(30,80+1.1*hts[1:30],7),rnorm(70,70+0.8*hts[31:70],10)) > >>> par(mfrow=c(2,2)) > >>> hist(wts,main="Freq") > >>> hist(wts,prob=TRUE,main="Prob") > >>> hist(wts,nclass=4,main="4 bins") > >>> > hist(wts,breaks=seq(80,210,by=10),main="Breaks > >> by > >>> 10") > >>> > >>> Is there a way to import your data into R along > >> with > >>> the script or it has to be imported separately? > >>> Thanks again > >>> > >>> --- "Lindsay, Dwayne" <[EMAIL PROTECTED]> wrote: > >>> > >>>> Felipe- > >>>> > >>>> This is a sample of code that I often use: > >>>> Call RInterface.RRun(" > source(""C://temp//Capital > >>>> Tracking Script.txt"", > >>>> local = F, chdir = T) ") > >>>> > >>>> Where the .txt file is my R-script saved as a > >> .txt > >>>> file. I find it a > >>>> lot easier to do most of my programming in R, > and > >>>> use VBA only as an > >>>> interface for the end-user. It's also easier > in > >>>> terms of maintenance. > >>>> I hope this helps and please let if you need a > >>>> little more info. > >>>> > >>>> Also, 'source' is a R-command that I insert > into > >> the > >>>> RExcel VBA wrapper. > >>>> Be sure to double up on the: /. For example, R > >> will > >>>> execute: > >>>> source(""C://temp//Capital Tracking > Script.txt"", > >>>> local = F, chdir = T), > >>>> but it will not execute: > source(""C:/temp/Capital > >>>> Tracking Script.txt"", > >>>> local = F, chdir = T) > >>>> > >>>> Dwayne > >>>> > >>>> -----Original Message----- > >>>> From: [EMAIL PROTECTED] > >>>> > [mailto:[EMAIL PROTECTED] > >> On > >>>> Behalf Of Felipe > >>>> Carrillo > >>>> Sent: Monday, August 13, 2007 5:37 PM > >>>> To: rcom-l@mailman.csd.univie.ac.at > >>>> Subject: [Rcom-l] Excel Macro > >>>> > >>>> Hi all: > >>>> Running the code below in R I am able to create > a > >>>> line > >>>> graph. Is there a way to run the same code from > >> an > >>>> Excel macro and get the same results? > >>>> > >>>> chinook <- read.table("C:/Documents and > >>>> Settings/Owner/Desktop/R-Software/chinook.txt", > >>>> header=T,sep="\t") > >>>> chinook$IDDate <- as.Date(chinook$IDDate, > >>>> "%m/%d/%Y") > >>>> qplot(IDDate,Fry, data=chinook, geom="line") > >>>> > >>>> Someone told me about > >>>> RInterface.RunRFile(filename).Does anyone can > >> show > >>>> me > >>>> how to use it? > >>>> Thanks > >>>> > >>>> > >>>> > >>>> Felipe D. Carrillo > >>>> Fishery Biologist > >>>> US Fish & Wildlife Service > >>>> Red Bluff, California 96080 > >>>> > >>>> > >>>> > >>>> > >>>> > > > ________________________________________________________________________ > >>>> ____________ > >>>> Sick sense of humor? Visit Yahoo! TV's > >>>> Comedy with an Edge to see what's on, when. > >>>> http://tv.yahoo.com/collections/222 > >>>> _______________________________________________ > >>>> Rcom-l mailing list > >>>> Rcom-l@mailman.csd.univie.ac.at > >>>> > > > http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l > >>>> More information (including a Wiki) at > >>>> http://rcom.univie.ac.at > >>>> _______________________________________________ > >>>> Rcom-l mailing list > >>>> Rcom-l@mailman.csd.univie.ac.at > >>>> > > > http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l > >>>> More information (including a Wiki) at > >>>> http://rcom.univie.ac.at > >>>> > >>> > >>> Felipe D. Carrillo > >>> Fishery Biologist > >>> US Fish & Wildlife Service > >>> Red Bluff, California 96080 > >>> > >>> > >>> > >>> > > > ____________________________________________________________________________________ > >>> Park yourself in front of a world of choices in > >> alternative vehicles. Visit the Yahoo! Auto Green > >> Center. > >>> http://autos.yahoo.com/green_center/ > >>> _______________________________________________ > >>> Rcom-l mailing list > >>> Rcom-l@mailman.csd.univie.ac.at > >>> > > > http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l > >>> More information (including a Wiki) at > >> http://rcom.univie.ac.at > >>> > >> > >> -- > >> Erich Neuwirth, University of Vienna > >> Faculty of Computer Science > === message truncated === Felipe D. Carrillo Fishery Biologist US Fish & Wildlife Service Red Bluff, California 96080 ____________________________________________________________________________________ Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting _______________________________________________ Rcom-l mailing list Rcom-l@mailman.csd.univie.ac.at http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l More information (including a Wiki) at http://rcom.univie.ac.at