Displaying 20 results from an estimated 89 matches for "foo3".
Did you mean:
foo
2006 Apr 11
2
About list to list - thanks
Thank you very much for your useful suggestions.
These are exactly what I was looking for.
foo <- list(foo1, foo2, foo3)
lapply(foo, function(x) matrix(unlist(x), nrow = length(x), byrow = TRUE))
or
lapply(foo, function(x) do.call('rbind', x))
Best, Muhammad Subianto
On 4/11/06, Muhammad Subianto <msubianto at gmail.com> wrote:
> Dear all,
> I have a result my experiment like this below (here m...
2006 Apr 11
2
About list to list
Dear all,
I have a result my experiment like this below (here my toy example):
foo1 <- list()
foo1[[1]] <- c(10, 20, 30)
foo1[[2]] <- c(11, 21, 31)
foo2 <- list()
foo2[[1]] <- c(100, 200, 300)
foo2[[2]] <- c(110, 210, 310)
foo3 <- list()
foo3[[1]] <- c(1000, 2000, 3000)
foo3[[2]] <- c(1100, 2100, 3100)
list(foo1,foo2,foo3)
The result:
> list(foo1,foo2,foo3)
[[1]]
[[1]][[1]]
[1] 10 20 30
[[1]][[2]]
[1] 11 21 31
[[2]]
[[2]][[1]]
[1] 100 200 300
[[2]][[2]]
[1] 110 210 310
[[3]]
[[3]][[1]]
[1] 1000 2000 3000...
2008 Mar 25
1
Passing (Optional) Arguments
Dear List:
In short, I am writing a number of functions as building blocks for
other functions and have some questions about scoping and passing arguments.
Suppose I have functions foo1, foo2, and foo3 such that:
foo1<-function(a=1,b=TRUE,c=FALSE){#do stuff};
foo2<-function(x=1,y=FALSE,z=c(1,2,3,4)){#do stuff};
foo3<-function(lambda,...){lambda*foo1()*foo2()};
I want to be able to pass a,b,c,x,y,z to the functions foo1 and foo2
though foo3 (whether I define default values or not)....
2006 Jun 29
3
advice on arguments
I have a general style question about R coding.
Suppose I'm writing a function (foo1) that calls other functions
(foo2, foo3, ...) which have complicated argument
lists (e.g. optim(), plot()), _and_
I may be calling several different functions in the body of
foo1. Since foo2 and foo3 have different sets of arguments, I
can't just use "..." ; I did write some code a while ago that
would look at formals() to...
2018 Sep 02
2
Replacing a function from one module into another one
...,
What does that tool does besides what LLVM linker already does? I don't
think my problem is in linking both modules, I think LLVM linker does the
job for me, the issue is when changing the called function to call another
function (in the example previously provided, to change it from foo2 to
foo3, and adjusting the function parameter's references).
Regards,
Daniel Moya
El dom., 2 de sep. de 2018 a la(s) 17:00, Ahmad Nouralizadeh Khorrami (
ahmad.llvm at gmail.com) escribió:
> Hi.
> Besides the LLVM linker, you can also use this tool:
> https://github.com/travitch/whole-progr...
2018 Sep 02
2
Replacing a function from one module into another one
...thanks for the answer,
I'm still facing issues, I'll do my best to explain my situation, as I
explained, I have two modules, each one with its own main and functions, I
would like to replace in the *oldModule* a function call that is calling
*foo2* (defined in *oldModule*) to instead call *foo3*, which is defined in
the *refModule. *So in summary, I have:
1. The original instruction call, defined in the main function of
the oldModule, who is a calling function to foo2, I'll name it
*oInst *(original
Instruction)
2. The "new" instruction call, defined in the mai...
2018 Sep 03
2
Replacing a function from one module into another one
...module to another one. I'm still
facing the issue with the *llvm::SmallVectorImpl< llvm::ReturnInst *>
&Returns *argument for the *CloneFunctionInto, *can anyone please give an
example of use of that function? I guess that's the only way because
otherwise if I move the blocks from foo3 in the refModule to the oldModule,
the references of the moved block still point to the arguments of foo3
defined in the refModule, and I don't know how to go instruction by
instruction in all the moved blocks and correct the reference to point to
the arguments in the oldModule's new functi...
2018 Sep 06
2
Replacing a function from one module into another one
...*refMod_copy = refMod.get();
addFunction(origMod_copy, refMod_copy, newFuncName, oldFuncName);
printModule(origMod_copy);
std::cout << "Finish\n"; // Make sure the program finished
}
int main() {
std::string oldFuncName = "foo2";
std::string newFuncName = "foo3";
replaceFunctions(oldFuncName, newFuncName);
return 0;
}
The complete error after printing the module (I know the error it's after
the program's execution because the "Finish" is printed before):
Finish
While deleting: i32 %
Use still stuck around after Def is destroy...
2006 Oct 19
1
default arguments in generics and methods
...FALSE)
setMethod("foo", signature(x = "missing"), function(x = 3) x)
setGeneric("foo2", function(x = 1) {x; standardGeneric("foo2")},
useAsDefault = FALSE)
setMethod("foo2", signature(x = "missing"), function(x = 3) x)
setGeneric("foo3", function(x = 1) {x<-2; standardGeneric("foo3")},
useAsDefault = FALSE)
setMethod("foo3", signature(x = "missing"), function(x = 3) x)
setMethod("foo3", signature(x = "numeric"), function(x = 3) x^2)
foo() # returns 3
foo2() # returns...
2018 Aug 27
3
Replacing a function from one module into another one
...anyways. For example,
the original function is:
define i32 @foo2(i32 %a, i32 %b) #0 {
entry:
%a.addr = alloca i32, align 4
%b.addr = alloca i32, align 4
store i32 %a, i32* %a.addr, align 4
store i32 %b, i32* %b.addr, align 4
And the function that is going to replace that is:
define i32 @foo3(i32 %a, i32 %b) #0 {
entry:
%a.addr = alloca i32, align 4
%b.addr = alloca i32, align 4
store i32 %a, i32* %a.addr, align 4
store i32 %b, i32* %b.addr, align 4
So they are pretty much the same except for the name (the functions differ
later in the code, but the error happens at the beginni...
2018 Sep 04
2
Replacing a function from one module into another one
...internet. To
begin with, as the name implies (and also from some errors that I got) the
ValueToValueMapTy takes a std::pair<llvm::Value, llvm::Value>, but what I
need is to map the arguments (llvm::Attribute) of both functions (the first
argument of foo2 is equivalent to the first argument of foo3, and so on),
however, apparently there's no transformation from a llvm::Attribute to a
llvm::Value. I'm using the function getAttribute
<http://llvm.org/doxygen/classllvm_1_1Function.html#ab2a5fc8baaee7e74dbe47d848508745a>
(unsigned <http://llvm.org/doxygen/classunsigned.html>...
2018 Sep 06
2
Replacing a function from one module into another one
...the name implies (and also from some errors that I got) the
>> ValueToValueMapTy takes a std::pair<llvm::Value, llvm::Value>, but what I
>> need is to map the arguments (llvm::Attribute) of both functions (the first
>> argument of foo2 is equivalent to the first argument of foo3, and so on),
>> however, apparently there's no transformation from a llvm::Attribute to a
>> llvm::Value. I'm using the function getAttribute
>> <http://llvm.org/doxygen/classllvm_1_1Function.html#ab2a5fc8baaee7e74dbe47d848508745a>
>> (unsigned <http://llvm...
2010 Feb 10
1
How to solve: Error in * unused argument(s) ?
...For some reason, I would like to use functions bellow (see example code
bellow), but instead I get the following error message:
*Error in foo2(...) : unused argument(s) (arg3 = 3)*
#---------------------
# example code
#---------------------
foo1 <- function(arg1,...)
{
print(arg1)
foo2(...)
foo3(...)
}
foo2 <- function(arg2)
{
print(arg2)
}
foo3 <- function(arg3)
{
print(arg3)
}
foo1(arg1 = 1, arg2 = 2, arg3 =3)
#---------------------
I tried looking through the R Language Definition, but couldn't find
something that helped me understand the issue (way it should happen, a...
2012 Nov 06
1
Depends/Imports/Suggest/Enhence
Hi the list
In the DESCRIPTION file of my package foo0, I have:
Depends: foo1
Imports: foo2
Suggest: foo3
Enhence: foo4
If I understand correctly, to install foo0 on my computer, I need to already have foo1, foo2, foo3.
foo4 is not necessary.
I my R sesssion, when I will write: library(foo0), then the package foo1 will be attach. foo2, foo3
and foo4 will not. Is that correct?
But what is the diffe...
2004 Apr 20
2
Creating variable names
...doubtless a dumb question, but I have
scant experience in R.
It would be very convenient in doing lots of plots to be able to do them
in a loop that stepped through a vector of variable names. For example
one could say
x<-("mydates")
y<-c("foo1","foo2","foo3") #where "foon" were vectors
plot(x,y[1],type="n")
points(x,y[1])
points(x,y[2],pch=2)
points(x,y[3],pch=3)
This is pretty easy in Perl, but of course Perl is not for plotting. Of
course one could construct a data structure in R that would hold what
was wanted and maybe...
2007 Dec 13
2
use ggplot in a function to which a column name is given
...could be shorter)
B = A[A$y<=5,c("x","y",uv)]
names(B)[3] = "value"
# rem: cannot use rename since rename(B,c(uv="value")) would not work
qplot(x, y, fill=value, data=B, geom="tile")
# or
# ggplot(B,aes(x=x,y=y,fill=value)) + geom_tile()
}
foo3 <- function(uv="u")
{
# solution 3: use the data argument and perform the extraction
directly in it
# (elegant and powerful but can't make it work)
ggplot(A[A$y<=5,c("x","y",uv)],aes(x=x,y=y,fill=???)) + geom_tile()
# or
ggplot(A[A$y<=5,],aes(x=x,y=...
2010 Mar 23
1
S4: Multiple inheritance
Hi all,
Working with S4 object, I definine two class foo1 and foo2. I define '['
(resp. '[<-') for the two classes.
Then I define a third class foo3 that inherit from both foo1 and foo2.
Is there a way to make '[' (resp. '[<-') for foo3 inherit from '['
(resp. '[<-') for foo1 and foo2?
Thanks
Christophe
2011 Jun 20
1
access objects by name
Hi,
I have several data structures (xts structures). I then have a list of the names of those objects.
I'd like to access the object by name.
For example:
foo1 <- as.xts(....)
foo2 <- as.xts(...)
foo3 <- as.xts(...)
structs <- c("foo1", "foo2", "foo3")
for (thisOne in structs){
print(thisOne$colA)
}
The above fails. Clearly I'm missing a step translating the name to the object.
Suggestions?
Thanks
--
Noah Silverman
UCLA Department of Statistics
8...
2010 Jun 01
0
codetools: Suggestion to detect potentially unassigned variables
This is just a note/wishlist/for the record:
With
foo1 <- function() {
res;
}
foo2 <- function() {
for (i in c()) res <- 1;
res;
}
foo3 <- function() {
while (FALSE) res <- 1;
res;
}
foo4 <- function() {
if (FALSE) res <- 1;
res;
}
we get:
> foo1()
Error in foo1() : object 'res' not found
> foo2()
Error in foo2() : object 'res' not found
> foo3()
Error in foo3() : object 'res'...
2013 Apr 02
2
How to remove all characters after comma in R
I have the following list of strings:
x <- c("foo, foo2, foo3", "bar", "qux, qux1")
what I want to do is to obtain
foo, bar qux
Namely for each element in the vector obtain only string
before the first comma.
What's the way to do it?
- G.V.
[[alternative HTML version deleted]]