Hi Benoit, If you are in the directory that contains your data, you can use
> NC60 = read.table("NC60.DATA") # there are some arguments you can use in "read.table" OR >NC60 = read.table("path to your data/NV60.DATA") > yo(NC60) By the way, I do not know your "LgmFormula". I think you already defined it. Rao Fu Ph.D Yale University Department of Statistics Email: [EMAIL PROTECTED] >>Date: Wed, 10 Sep 2008 15:22:37 +0200 >>From: "Benoit Boulinguiez" <[EMAIL PROTECTED]> >>Subject: [R] writing simple function through script >>To: <r-help@r-project.org> >>Message-ID: <001601c91348$4b505a20$>>[EMAIL PROTECTED]> >>Content-Type: text/plain >> >>Hi all, >> >>I try to write a simple function in a script. The script is as follows >> >>yo<-function(Xdata) >>{ >>n<-length(Xdata[,1]) >> >>Lgm<-nls(formula=LgmFormula, >> data=Xdata, >> start=list(a=1500,b=0.1),weights=Xdata$Qe) >>return(Lgm) >>} >> >>After the execution of the script, when I call the function yo on data >>called NC60.DATA I get an error. >> >>#yo(NC60.DATA) >>Erreur dans eval(expr, envir, enclos) : objet "Xdata" not found >> >> >>The object Xdata isn't found. Why? >>Is that possible to debug a function with R? >> >>Regards/Cordialement >> >>----------- >>Benoit Boulinguiez >>Ph.D >>Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 >>Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes" >>Campus de Beaulieu, 263 Avenue du Général Leclerc >>35700 Rennes, France >>Tel 33 (0)2 23 23 80 83 >>Fax 33 (0)2 23 23 81 20 >>http://www.ensc-rennes.fr/ <http://www.ensc-rennes.fr/> [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.