similar to: function not found

Displaying 20 results from an estimated 11000 matches similar to: "function not found"

2001 Mar 07
3
export graph to Word/Excel
Hi, I have a set of script like this: ---------------------- summary(data) plot(time, users, type="o", xlab ="Time", ylab="Number of Users") ---------------------- I type "rterm --slave < script.r > output.doc" and the graphic doesn't actually in the output.doc file. How to make the graphic embedded in Word or Excel file? Thanks, Yu-Ling Wu
2001 Mar 14
3
get statistics by group
Hi, I have a data set look like this: ================================= Fruit Quty apple 20 banana 10 orange 17 apple 30 apple 15 orange 26 banana 15 .........and so on .......... ================================= The level of fruit is 30, that is, there are 30 different fruits. I'd like to compute some simple statistics for each different fruit and get output like this:
2001 Feb 13
1
pass a string to a function
Hi, I'd like to pass a string to a function as the value of the argument. Here is my code. However, it doesn't work. Please help me with this. Thanks, Yu-Ling Wu ----------------------------------------------------- library(RODBC) odbcConnect("console") -> myConnect fun1 <- function(dd1) { h3 <- sqlQuery(myConnect, "select * from console where byday =
2000 Dec 21
1
RODBC install unsuccessfully
Hi, I use R under Windows NT. I download "RODBC.zip" and unzip it to "e:/R/rm1011/lib/" in order to connect to MySQL. And then I add an MySQL ODBC data source in the Control Panel. When I type "library()" under R, I can see "RODBC" is one of the packages. However, when I type "library (RODBC)", I got an error message like this: The procedure
2001 Feb 13
2
run R under DOS prompt
Hi, I have a xxx.R file. In order to run this file, I have to go to R, and type -- source("xxx.R"). Two questions: 1. How to run file xxx.R under DOS prompt instead of entering R environment? 2. There are several functions in file xxx.R, how to pass the arguments to the function when I try to run this file via source() function (or under DOS mode)? Thanks, Yu-Ling Wu
2008 Jan 28
1
package.skeleton from within function: objects not found
Hi all, I ran into a strange error: I am trying to create a package skeleton for a new source package from within a function. Objects that are created in this function are to be included in my package, but for some reason, I get an error message saying that these objects cannot be found. Here is the code: ###### myfun <- function(pkgName,x){ myenv <- new.env() apply(x, 1,
2001 Mar 21
5
generate random number
Hi, I want to pick 3 "integer" random numbers from 1 to 10. How to do this? Thanks, Yu-Ling Wu __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read
2010 Sep 03
3
S4 Method Signatures
Hello, If the signature of a method defines which generic it implements then I'm confused about why this minimal example I invented won't work : setGeneric("myFun", function(rs, ...){standardGeneric("myFun")}) setGeneric("myFun", function(cs, ...){standardGeneric("myFun")}) setMethod("myFun", "numeric", function(rs, colour =
2006 Feb 02
2
How to get the namespace of a function?
I declared the environment of the function myfun to be NULL as follows: environment(myfun) <- NULL Later on I called that myfun and got an error message because the function index() in the zoo package was called inside myfun and was not visible: Error in myfun(args) : couldn't find function "index" I tried to use zoo::index() instead of index(), but that did not work. In fact,
2011 Feb 02
1
pass nrow(x) to dots in function(x){plot(x,...)}
Dear Rers, I have a function to barplot() a matrix, eg myfun <- function(x, ...) { barplot(x , ... )} (The real function is more complicated, it does things to the matrix first.) So I can do: m1 <- matrix(1:20,4) myfun(m1) myfun(m1, main="My title") I'd like to be able to add the number of rows of the matrix passed to the function to the "..." argument, eg
2009 Jun 12
1
how to trigger variable creation?
Hello R users, i'm wondering how to trigger variable creation. Whenever a variable is created i want my own function myFun(...) to be started. if (exists("x")) {rm(x)} # after removal of x # any of these calls x<-10 # should call myFun x=10 # should call myFun assign(x,10) # should call myFun etc.
2001 Feb 13
0
handle date variables
Thanks! This is helpful. Three more questions. 1. How to convert a string into a numeric value. For example, convert '20010122' to 20010122. 2. How to convert a string into a date value. For example, convert 20010122 to 2001 Jan 22, and get its day of the week, i.e. Monday? 3. How to handle date variables in a loop? How to make the following codes work? And how users should pass the
2015 Oct 22
2
Changed behaviour when passing a function?
Of course (and unsurprisingly) Duncan is correct. I see that behavior in R 3.1.0, as well as the modern ones Duncan mentioned. What I said is true, as far as it goes, but the symbol being resolved is FUN, so when looking for a function it doesn't find the function version of round. Did you perhaps have a function named FUN in your global environment? If so you are being bitten by what I
2002 Jan 07
1
Mishandling missing "..." (PR#1247)
R> myfun <- function(x, ...) {x[...] <- 0; x} R> myfun(3) Error in myfun(3) : SubAssignArgs: invalid number of arguments It fails because no ... was passed. The workaround (and desired behavior) is: R> myfun <- function(x, ...) {if (missing(...)) x[] <- 0 else x[...] <- 0; x} R> myfun(3) [1] 0 Deja vu? This is the one piece of my PR#1110 (Oct 3, 2001) that I
2011 Jul 23
1
call a function with explicitly not setting an argument
Is there a way to call a function, and explicitly set an argument to 'not specified'? My situation is the following. I have a function which passes on most of its arguments to another function. The second function, myfun2, serializes all arguments and is out of my control. myfun <- function(...){ return(myfun2(...)); } now, the value for arguments of myfun are stored in variables.
2012 Jul 05
1
Extracting srcref for S4 methods
Hi, on R version 2.15.1 (2012-06-22) (Platform: i686-pc-linux-gnu (32-bit)) sourced functions have srcref attached as an attribute. Are such data also available for S4 generics and methods? How? (See sample code below) Thank you. Bests, Renaud f <- textConnection( " f <- function(){} setGeneric('myfun', function(x, ...) standardGeneric('myfun'))
2007 Feb 23
1
how to use apply with two variables
Hi, this is a made-up example. Function "myfun" returns two arguments. Can "apply" be used so that "myfun" is called only once? Thanks Serguei mat<-matrix(runif(50),nrow=10,ncol=5) myfun<-function(x) { mymean<-mean(x) mysd<-sd(x) return(mymean,mysd) } out1<-t(apply(mat,1,function(x) myfun(x)$mymean)) out2<-t(apply(mat,1,function(x)
2011 Feb 03
1
mapply question (?)
Hi, I have a function myFun which I want to call multiple times, using different argument lists. myFun("v1", "2009", 1) myFun("v2", "2008", 1) myFun("q", "2001") How can I easily do this in R? Should I use mapply? I unsuccessfully tried something like: x <- list(c("v1", "2009", 1), c("v2",
2006 Apr 20
1
Bootstrap error message: Error in statistic(data, origina l, ...) : unused argument(s) ( ...)
> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Michael > Sent: Thursday, April 20, 2006 3:50 AM > To: R-help at stat.math.ethz.ch > Subject: [R] Bootstrap error message: Error in > statistic(data, original, ...) : unused argument(s) ( ...) [Broadcast] > > > Dear colleagues, >
2023 Aug 03
3
feature request: optim() iteration of functions that return multiple values
Dear all, I have used optim a lot in contexts where it would useful to be able to iterate function myfun that, in addition to the primary objective to be minimized ('minimize.me'), could return other values such as alternative metrics of the minimization, informative intermediate values from the calculations, etc. myfun <- function() { ... return(list(minimize.me = minimize.me, R2 =