After I source an R code, how can I call the function? Thanks Rick --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.350 / Virus Database: 196 - Release Date: 17/4/2002 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Ricardo Gon?alves <ricardo at icmc.sc.usp.br> writes:>After I source an R code, how can I call the function?I assume the your R code that you source contains function definitions. If that is the case then call the functions as you would any other R function. Mark -- Mark Myatt -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi,
I am not quite sure, but as I understand you have a file (like
"foo.R")
containing some commands like
cat("Hello world\n")
f2 <- function(x) x*x
when saying
> source("foo.R")
you get message
Hello world
and you get also the function f defined. So simply say
> f(4)
to get 16.
Was it what you wanted?
Ott
On Thu, 18 Apr 2002, [iso-8859-1] Ricardo Gon?alves wrote:
|After I source an R code, how can I call the function?
|Thanks
|Rick
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
When I try to load my dataset I receive the following message:> read.table("growth.txt", header = TRUE, row.name=1);Error in "row.names<-.data.frame"(*tmp*, value = row.names) : duplicate row.names are not allowed The Dataset consists in 98 individuals and 48 variables (at the first line) named Y, X1, X2, ..., X47. When I try :> read.table("growth.txt", header = TRUE);The data loads to the console but when I try to manipulate it R never founds the object. Any help will be welcome Rick --- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Ricardo Gon?alves <ricardo at icmc.sc.usp.br> writes:> When I try to load my dataset I receive the following message: > > read.table("growth.txt", header = TRUE, row.name=1); > Error in "row.names<-.data.frame"(*tmp*, value = row.names) : > duplicate row.names are not allowed > The Dataset consists in 98 individuals and 48 variables (at the first line) named Y, X1, X2, ..., > X47. > When I try : > > read.table("growth.txt", header = TRUE); > The data loads to the console but when I try to manipulate it R never founds the object.Unless you assign the value of a function call to a name, it will be printed and removed. Try growth <- read.table("growth.txt", header = TRUE) summary(growth) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._