[R] Problem executing function
Divyam
divyamurali13 at gmail.com
Tue Oct 11 15:21:54 CEST 2011
Hello All,
I have a series of steps that needs to be run many times. Hence I put them
all into a function. There is no problem in function creation, but when I
call the function, the steps are not getting executed or only the first step
gets executed. What possibly could be the reason?
Sample Function and the result:
fun <- function ()
{
# Package load into R;
a <- c(library("RODBC"),library("e1071"));
b <- read.csv("Path of the csv file", header=TRUE,sep=",",quote="");
c <- b[,1];
d <- b[,2];
e <- b[,3];
rm(b);
# Establishing ODBC connection;
conn <- odbcConnect(c,uid=d,pwd=e);
}
fun()
Warning messages:
1: package 'RODBC' was built under R version 2.13.1
2: package 'e1071' was built under R version 2.13.1
The subsequent csv fetch and odbc connection establishment are not getting
executed. Why is the function not getting executed fully? Even if I create a
separate function for csv file fetch, it is not being executed. But if I
simply type on the command prompt directly b <- read.csv("Path of the csv
file", header=TRUE, sep=",",quote=""); it is working. Why is it like this?
I am not able to figure out the mistake.
Any help will be much useful. Have been struggling with this for quite some
time now.
Thanks
Divya
--
View this message in context: http://r.789695.n4.nabble.com/Problem-executing-function-tp3894359p3894359.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list