Displaying 20 results from an estimated 1000 matches similar to: "Retrieving function name"
2006 Nov 21
1
dyn.load
Hi everyone,
Now I know there is information on this in the help files - which I have
read. I am very close to implementing this but can't quite get how to
remove this final hurdle.
I have a DLL called "X.DLL" which I have no original code for, just the
DLL.
I have created a wrapper C file for the calls in X.DLL, and have
successfully (I think) created a wrapper DLL for X
2006 Nov 17
2
Data table in C
After getting one list done, I am now struggling to form a data frame in C.
I tried to do a list of lists which gives me :
$<NA>
$<NA>[[1]]
[1] "BID"
$<NA>[[2]]
[1] 0.6718
$<NA>[[3]]
[1] 3e+06
$<NA>
$<NA>[[1]]
[1] "BID"
$<NA>[[2]]
[1] 0.6717
$<NA>[[3]]
[1] 5e+06
$<NA>
$<NA>[[1]]
[1] "BID"
2006 Nov 14
2
String to list and visa versa
Hi,
I need to collapse a list into a string and then reparse it back into the
list. Normally when I need to do this I simply use write.csv and
read.csv, but I need to do this in memory within R rather than writing out
to file. Are there any bespoke commands that any knows of that does
something like this or any tips for doing this that anyone can suggest? I
basically don't care
2006 Nov 22
1
Ralloc clash
Hi everyone,
Have been trying to include windows.h (from MinGW) and R.h into a package
and have found that Ralloc is coming up as a clash no matter which include
ordering I use. In windows it has 2 arguments and is defined in objidl.h
and in R.h it is 3 arguments. Any ideas of how to work round this? Have
checked the web and have not seen anyone else comment on this.
Many thanks
Tom
2006 Nov 07
1
variable problem
Hi everyone,
I am not sure this is possible so I would be interested in your
responses. Say I have a variable 'v' with the string "myargument" in and
I have a function 'f' that takes this argument as follows;
f <- function( myargument=5 ) {
... does something...
}
Is there anyway I can say something like;
f( v=10 ) such that it will be evaluated as f(
2007 Jan 30
4
Speed of for loops
Hi Everyone,
I have a question about for loops. If you have something like:
f <- function(x) {
y <- rep(NA,10);
for( i in 1:10 ) {
if ( i > 3 ) {
if ( is.na(y[i-3]) == FALSE ) {
# some calculation F which depends on one or more of the previously
generated values in the series
y[i] = y[i-1]+x[i];
} else {
y[i] <- x[i];
}
}
}
y
}
e.g.
>
2007 Jan 30
4
Speed of for loops
Hi Everyone,
I have a question about for loops. If you have something like:
f <- function(x) {
y <- rep(NA,10);
for( i in 1:10 ) {
if ( i > 3 ) {
if ( is.na(y[i-3]) == FALSE ) {
# some calculation F which depends on one or more of the previously
generated values in the series
y[i] = y[i-1]+x[i];
} else {
y[i] <- x[i];
}
}
}
y
}
e.g.
>
2006 Nov 17
1
Manipulating R lists in C
Hi,
I have been studying the R manual on lists but cannot seem to create a
simple R list in C - I keep on getting "'dimnames' applied to non-array"
whenever I attempt to assign names to the list elements:
Wanted output a list structure something like
[ type="Bid", price=2.0, volume=1000 ]
I can get up to a list of
[ "Bid2, 2.0, 1000 ]
But for the life of
2006 Dec 09
2
Floating point maths in R
Hi,
I am not sure if this is just me using R (R-2.3.1 and R-2.4.0) in the
wrong way or if there is a more serious bug. I was having problems
getting some calculations to add up so I ran the following tests:
> (2.34567 - 2.00000) == 0.34567 <------- should be true
[1] FALSE
> (2.23-2.00) == 0.23 <------- should be true
[1] FALSE
> 4-2==2
[1] TRUE
> (4-2)==2
[1] TRUE
>
2007 Jan 26
0
Cross-network printing
Hi,
For a machine connected over the internet to pass through a firewall and
print using samba what ports do I need open? I am using CUPS and SAMBA so
do I need to open up the ports to connect to CUPS as well as SAMBA?
Basically is the situation when printing with samba at the point of
connection to the printer a or b below?
(a) remote machine --> print job --> firewall -->
2007 Jan 23
1
Port Problem
Hi Everyone,
Hope I have sent this to the correct list. I have been struggling away
with a weird problem all evening and have not had any joy on google so
thought I would try here.
The problem in a nutshell is as follows:
(Internal Network) Windows XP (Client) ---> Fedora Core4 (Samba
Server) Both shared areas and printers work from windows client.
(External Network) Windows XP
2010 Mar 31
2
Simplifying particular piece of code
Hello, everyone
I have a piece of code that looks like this:
mrets <- merge(mrets, BMM.SR=apply(mrets, 1, MyFunc, ret="BMM.AV120",
stdev="BMM.SD120"))
mrets <- merge(mrets, GM1.SR=apply(mrets, 1, MyFunc, ret="GM1.AV120",
stdev="GM1.SD120"))
mrets <- merge(mrets, IYC.SR=apply(mrets, 1, MyFunc, ret="IYC.AV120",
2004 Sep 09
4
scoping rules
Can someone help me with this simple example?
sq <- function() {
y <- x^2
y
}
myfunc <- function() {
x <- 10
sq()
}
myfunc()
executing the above in R yields:
> myfunc()
Error in sq() : Object "x" not found
I understand that R's scoping rules cause it to look for "x" in the
environment in which "sq" was defined (the global environment in
2011 Feb 18
1
debugger() fails if "..." in function arguments
Dear all,
I'm having a problem with debugger() in both R 2.8.0 and R 2.12.0.
Probably also versions in-between.
I don't see it logged in the bug database, but it's hard for me to
imagine that no-one else has encountered it. So my question is whether
it's a known problem with a workaround, or do I log it as a new problem?
The situation is that if I use
2012 Jul 20
3
Execute a function
Hi,
I would like to evaluate a function, with 3 arguments, for instance,
myfunc<-function(a,b,c) { sqrt(a)-exp(b)+4*c
}
How to execute myfunc(x,y,z), for all x, all y and all z, where x,y,z are
vectors?
Thank you very much in advance
--
View this message in context: http://r.789695.n4.nabble.com/Execute-a-function-tp4637182.html
Sent from
2012 Aug 29
5
Extracting the name of a function (inverse of match.fun("myFun"))
Hi all,
is there a way to extract the name of a function, i.e. do the reverse
of match.fun applied to a character string? I would like to print out
the name of a function supplied to another function as an argument.
For example:
myFunc = function(x) { x+1 }
applyFunc = function(fnc, x)
{
fnc = match.fun(fnc)
fnc(x)
}
Is there a way to obtain "myFunc" from the argument fnc in
2006 Nov 09
3
function
R-help,
I am trying to create a function that i pass a data set to and have the
function return some calculations based on data.
Allow me to illustrate:
myfunc <- function(lst,mn,sd){
lst <- sort(lst)
mn <- mean(lst)
sd <- sqrt(var(lst))
return(lst,mn,sd)
}
data1 <-c (1,2,3,4,5)
data2 <- c(6,7,8,9,10)
myfunc(data1,data1mn,data1sd)
myfunc(data2,data2mn,data2sd)
2011 Jan 10
2
Integration in R
Dear all,
It has been ages since I studied integration in college. Right now I
try to recover all this kind of knowledge and then try to understand how
integration works.
Thus I am doing some first 'experiments' and I would like to request your help and comments.
I have the function:
p2<-function(x){0.5*(3*x^2-1)}
# I found the square of p2 by using some pencil and
2002 Aug 03
2
variable scope
Dear R-guRus:
I would like to pass variables to a function in R in "by reference",
e.g Fortran style.
For example, suppose I have the following code
x<-c(1:10)
y<-1
MyFunc<-function(x,y) {y<-sum(x); return(NULL)}
MyFunc(x,y)
print(y)
in this case print(y) will produce "1" instead of 55 (which is sum(x)) -
how do I make sure that afte the function is run, y
2002 Aug 03
2
variable scope
Dear R-guRus:
I would like to pass variables to a function in R in "by reference",
e.g Fortran style.
For example, suppose I have the following code
x<-c(1:10)
y<-1
MyFunc<-function(x,y) {y<-sum(x); return(NULL)}
MyFunc(x,y)
print(y)
in this case print(y) will produce "1" instead of 55 (which is sum(x)) -
how do I make sure that afte the function is run, y