Displaying 20 results from an estimated 1200 matches similar to: "Overloading functions"
2006 Oct 25
1
Cross-compilation
Hi everyone,
I am trying to cross-compile a package I wrote using the Yan and Rossini
tutorial "Building Microsoft Windows versions of R and R packages using
Intel Linux". I have got reasonably far with this but when doing the
linking using the line:
i586-mingw32-g++ -shared -s -o mylibrary.dll mylibrary.def mylibrary.o
mylibrary_res.o
2003 Jan 22
4
Read.table for macs
Dear All,
I've been using R for windows for a while, without too many problems.
However, I'm forced to use the MAC OS system for teaching, because our
teaching labs are mac only (not my idea!!). I have a very basic problem,
but one that doesn't appear on the FAQs. I simply want to import data
from a spreadsheet. I'm using exactly what works fine on Windows, namely:
1 save
2015 Jan 28
2
[Q] Get formal arguments of my implemented S4 method
I'm attempting to reflect the information for use with corresponding
fields in GUI (in a different package), to provide default values,
argname as key for UI label lookups, etc.
So I want something much more like the formals of the implementation:
{
"object",
"method": c("median", "vs", "tukey"),
2006 Apr 13
2
[R] S4 method dispatch matrixOrArray (fwd)
What a delicious example! (I'm taking the liberty of sharing it with
r-devel, since it raises some good issues.)
You have two questions, presumably:
1 - how could the order of the setMethod calls make a difference in the
results?
2 - what's causing the infinite loop & how could it be avoided, reliably?
Second question first. The danger sign is the "vector" method:
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 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 09
2
Retrieving function name
Hi,
Does anyone know how I can retrieve a function name, for example
If I have a function f as follows:
f <- function( myfunc ) {
print( name_of(myfunc) );
}
I want to know what I should have as "name_of" such that I could call this
with :
f( median )
and it would print "median"
or f( my_function_name ) and it would print "m_function_name".
So far all I
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
2015 Jan 28
2
[Q] Get formal arguments of my implemented S4 method
Interrogating some (of my own) code in another package.
>norm.meth <- getMethod("normalize", "MatrixLike")
>message("str(norm.meth)")
>str(norm.meth)
>message("show(norm.meth at .Data)")
>show(norm.meth at .Data)
Last show() displays this:
function (object, ...)
{
.local <- function (object, method = c("median",
2006 Jan 16
1
ajax search
Hi everyone,
I''m a bit new to rails, but I have played around with it for the last month.
I really enjoy programming in rails and I feel that I should program my new
application through this framework.
I am very exited when I start creating my scaffolds and views, there is some
sense of accomplishment.
Now I would really like to make a search function my page that would search
through
2006 May 03
3
sprintf question
How would one go about getting sprintf to use the
values of a vector without having to specify each
argument individually?
> v <- c(1, 2, -1.197114, 0.1596687)
> iv <- c(3, 1, 2, 4)
> sprintf("%9.2f\t%d\t%d\t%8.3f", v[3], v[1], v[2], v[4])
[1] " -1.20\t1\t2\t 0.160"
Essentially, desired effect would be something like:
>
2012 May 30
2
Simple example for High performance computing with R?
Dear list,
I want to run two independent calculation (A, B) and then combined
their results to do a plot in R. Before I just run calculation A
first, then calculation B. It will take some times. I just have one
server with multiple core. I noticed that there are some nice package
in R for parallel calculation, such as parallel, multicore and snow.
Also there is a book, O?Reilly ? ?Parallel R,
2006 Mar 29
2
Recall for parent
What's the best way to simulate Recall for parent function?
Consider this one-time recursive code:
alwaysEven <- function(x) {
handleOdd <- function(x) {
alwaysEven(x-1) # use Recall-like here
}
return(if (x %% 2) handleOdd(x) else x)
}
any2even <- alwaysEven
rm(alwaysEven)
any2even(3)
----------------------------------------------------------
SIGSIG --
2005 Nov 12
2
sibling list element reference during list definition
Can the value of a list element be referenced from a
sibling list element during list creation without the use
of a temporary variable?
The following doesn't work but it's the general idea.
> list(value = 2, plusplus = $value+1)
such that the following would be the output from str()
List of 2
$ value : num 2
$ plusplus: num 3
2006 Feb 08
1
invalid graphics state using dev.print (fwd)
On Mon, 6 Feb 2006 18:12, Simon Urbanek wrote:
> On Feb 6, 2006, at 5:24 PM, Paul Roebuck wrote:
>
>> Tried on R-Sig-Mac with no responses, but I need some kind
>> of answer.
>> [...]
>> Does the following work on your system?
>
> Interesting, no, it doesn't either. For png and pdf I use
> Quartz + quartz.save (it produces much nicer results) so
> I
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
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.
>
2015 Jan 29
3
[Q] Get formal arguments of my implemented S4 method
On Jan 28, 2015, at 6:37 PM, Michael Lawrence <lawrence.michael at gene.com> wrote:
> At this point I would just due:
>
> formals(body(method)[[2L]])
>
> At some point we need to figure out what to do with this .local() confusion.
Agreed, definitely. The current hack is to avoid re-matching arguments on method dispatch, so a fix would need to be fairly deep in the
2005 Nov 14
1
Package manpage DCF hooks
Was looking at what was output for <pkgname>-package.Rd
and wondered if any there was any means (via macro, etc)
to merge some of the same information with a template
for my package manpage? As much (all?) of the generated
information was already provided in the DESCRIPTION, I'd
prefer not to have to update the information in multiple
places. I'm thinking here that I could provide a