Displaying 20 results from an estimated 1000 matches similar to: "C code validation"
2007 Sep 16
1
programming question
Dear list,
I have a vector of numbers, let's say:
myvec <- c(2, 8, 24, 26, 51, 57, 58, 78, 219)
My task is to reduce this vector to non-reducible numbers; small numbers can
cross-out some of the larger ones, based on a function let's say called
reduce()
If I apply the function to the first element 2, my vector gets shorted to:
> (myvec <- reduce(myvec[1]))
[1] 2 24 51
2003 Feb 11
0
samba 2.2.7a and multiple logins...
Hello
I use a new samba server with LDAP support as PDC for some Windows2000
and WindowsXP machines.
All is working nice. The useer can login with a user/password in the
domain, we have remote profiles, the user can access the samba shares
and print etc.
But after some time (< 1 day) we get a smbstatus output like the
attached file. Users are connected multiple times with the same share
2003 May 09
1
Bug report: deletion of files only on remote system is not logged.
I was told that my earlier submission of this report contained a
user-hostile attachment (courtesy of Outlook), so here it is again, with
the log included below.
The problem: Files that exist only on the remote system are deleted
silently (i.e. not logged), rather than noisily as implied by the
recommendation of --dry-run in the rsync man page definition of --delete
to see what would be
2007 Jan 21
2
multiple bases to decimal (was: comparing two matrices)
Hi again,
I was contemplating the solution using base 3:
set.seed(3)
mat2 <- matrix(sample(0:2, 15, replace=T), 5, 3)
Extracting the line numbers is simple:
bases <- c(3, 3, 3)^(2:0) # or just 3^(2:0)
colSums(apply(mat2, 1, function(x) x*bases)) + 1
[1] 7 23 25 8 1
The problem is sometimes the columns have different number of levels, as in:
mat1 <- expand.grid(0:2, 0:2,
2010 Nov 15
2
How to move an internal function to external keeping same environment?
Hi
I have within a quite big function foo1, an internal function foo2. Now,
in order to have a cleaner code, I wish to have the internal foo2 as
"external". This foo2 was using arguments within the foo1 environment
that were not declared as inputs of foo2, which works as long as foo2 is
within foo1, but not anymore if foo2 is external, as is the case now.
Now, I could add all those
2006 Jul 02
4
Test for argument in ...
Hello!
Say I have a function foo1, which has argument ... to pass various
arguments to foo2 i.e.
foo1 <- function(x, ...)
{
foo2(x, ...)
}
Say that foo2 accepts argument arg1 and I would like to do the following:
- if foo1 is called as foo1(x) then I would like to assign some value to
arg1 inside foo1 before calling foo2
arg1 <- "some value"
foo2(x, arg1=arg1)
- if foo1 is
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
2018 Apr 05
1
potential file.copy() or documentation bug when copy.date = TRUE
This is a recent R-devel. file.copy() is not vectorized if multiple
destinations succeed:
cat("foo1\n", file = "foo1")
cat("foo2\n", file = "foo2")
unlink(c("copy1", "copy2"), recursive = TRUE)
file.copy(c("foo1", "foo2"), c("copy1", "copy2"), copy.date = TRUE)
#> Error in
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]]
2014 May 02
1
Authors@R: and Author field
Hi to all
Authors@R: c(person("fooa","foob", role = c("aut","cre"),
email = "fooa.foob@fooc.de"),
person("foo1","foo2", role = c("ctb"),
email = "foo1.foo2@foo3.de"))
Author: fooa foob, with contributions from foo1 foo2
using r CMD check --as-cran .. (R 3.1
2012 Oct 17
1
Do *not* pass '...' to NextMethod() - it'll do it for you; missing documentation, a bug or just me?
Hi,
although I've done S3 dispatching for more than a decade now, I think
I managed to overlook/avoid the following pitfall when using
NextMethod():
If you explicitly pass argument '...' to NextMethod(), you will
effectively pass those argument twice to the "next" method!
EXAMPLE:
foo0 <- function(...) UseMethod("foo0");
foo1 <- function(...)
2004 Mar 29
0
Global assignment with S4 objects in R 1.9.0 beta
Hi,
some change during the last 10 days breaks code where slots of an
object are changed globally:
setClass("mylist", contains = "list")
setClass("dummy", representation = representation(
a = "mylist"))
foo1 = function(i, x) {
mydummy@a[[i]] <<- x ### change a slot
}
foo2 = function() { ### define an object
mydummy <<-
2014 Dec 08
2
CRAN packages mis-using \donttest : falsy
On Mon, Dec 8, 2014 at 3:32 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
[...]
> Why not declare colorspace as a "Suggests:" kind of dependency?
I guess that is a solution. :/
In another example in the 'disposables' package I have:
\donttest{
pkg <- make_packages(
foo1 = { f <- function() print("hello!") ; d <- 1:10 },
foo2 = { f
2010 Mar 15
2
Strange behavior of assign in a S4 method.
Hi the list,
I define a method that want to change an object without assignation
(foo(x) and not x<-foo(x)) using deparse and assign.
But when the argument of the method does not match *exactly* with the
definition of the generic function, assign does not work...
Anything wrong?
Christophe
#------ Does not work ------#
2015 Dec 17
2
Multiple IPs and hostname
Hi,
I'm running postfix as SMTP-server and dovecot as IMAP-server.
The server has multiple IPs, and postfix is configured that every domain
is using a separate IPv4-address.
Examle:
foo1.com --> 11.22.33.44
foo2.com --> 22.33.44.55
foo3.com --> 33.44.55.66
bar.org --> 66.77.88.99
The hostname of the server is: mail.bar.org
Now I have a request from one of my customers,
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
2010 Feb 10
1
How to solve: Error in * unused argument(s) ?
Hi all,
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)
{
2010 Apr 27
1
suggestion on method dispatch
Dear all, I have define a function and its methods as follows:
######## beginning of code
fn <- function(x,...){
UseMethod("fn")
}
fn.foo1 <- function(x, commonA=1, ...){
print("fn.foo1 is called.")
}
fn.foo2 <- function(x, uniqueFoo2, common=1, ...){
## uniqueFoo2 is a unique argument in fn.foo2
x <- uniqueFoo2; class(x) <- "foo1"
## use uniqueFoo2
2006 Dec 20
1
[LLVMdev] Instructions having variable names as operands
Dear Mr. Lattner:
You have asked me how my instruction set works.
If I code like this:
int foo1()
{
int x1,x2;
x1 =1;
x2 = foo2(x1);
return x2;
}
int foo2(int k)
{
if(k == 1)
k = 2;
return k;
}
int main ()
{
int j;
j = foo1();
}
This should be emitted like this:
Enter foo1;
reg x2, x1
add 1;x1
Call foo2;x1,x2
Exit foo1; x2
2004 Apr 23
1
symlink bug still not fixed
Hi.
I found and reported a bug about a year ago regarding
symbolic links but haven't seen any mention of it
since and it is still present in 2.6.1-pre2.
Just want to make sure it isn't forgotten.
It can be reproduced by synchronizing two directories,
one of which contains a normal file and the other has
a symlink of the same name. With the archive, update
and backup options set, rsync