Displaying 20 results from an estimated 2000 matches similar to: "several bugs (PR#918)"
2002 Mar 13
1
several bugs (PR#918) lists and matrices
### I got bit again by the same bugs I wrote about a year ago.
### The bugs are related to matrices and arrays of lists.
### 1. There is a clear inconsistency in how R handles two
### functionally equivalent statements.
### array() is able to take a list and create a matrix.
### matrix() is unable to create that matrix.
> vector("list", 2)
[[1]]
NULL
[[2]]
NULL
>
2010 Apr 21
2
suggestion how to use memcpy in duplicate.c
>From copyVector in duplicate.c :
void copyVector(SEXP s, SEXP t)
{
int i, ns, nt;
nt = LENGTH(t);
ns = LENGTH(s);
switch (TYPEOF(s)) {
...
case INTSXP:
for (i = 0; i < ns; i++)
INTEGER(s)[i] = INTEGER(t)[i % nt];
break;
...
could that be replaced with :
case INTSXP:
for (i=0; i<ns/nt; i++)
memcpy((char *)DATAPTR(s)+i*nt*sizeof(int),
2001 Apr 23
4
several bugs (PR#918) lists and matrices
## Thomas rightly points out that list() is not the best structure for
## homogeneous data. My example was the simplest that generated the
## error of a matrix structure that that doesn't work. The application
## that this is simplified from needs lists because the data isn't
## homogeneous. I am attempting to write a missing value class, where
## each item is a list. In the simplest
2002 Feb 26
3
Matrix of Elements of Different Types (was Interfacing pre-existing C++ library from R)
--- Prof Brian D Ripley <ripley@stats.ox.ac.uk> wrote:
>A matrix list? R lists are just vectors with elements of different types,
>and R matrices are just vectors with a dimension attribute.
When I saw the above I tried to create a matrix from a list but
could not get it to work:
my.lm <- lm( rnorm(10) ~ I(1:10) )
my.list <- list(1, 2, 3, 4, 5, 6, my.lm, my.lm, my.lm)
2006 Jul 18
2
send a list from R to C
Hello at all !
What is the correct form to give a list form R (e.g. list(c(-1,1),
"TestFile") ) to C. I have no problems, if I don't use character and I have
also no problems to give a character vector form R to C. But, if I combine
real and strings in a list then I don't know the correct syntax.
I try it with following (an example):
SEXP writeFile(SEXP headerR){
Image
2010 Feb 25
1
error in lmLists in lme4 package (bug?)
Hello,
I am trying to use lmLists in the lme4 package and copying over very
standard code from the nlme package given in 'Mixed-Effects Models in S
and S-Plus'. It appears to not accept an 'I(age-11)' in the formula,
though it will accept the formula with out the subtraction of 11 from
age. This seems like it would be a bug, since this is standard formula
syntax, unless
2000 Jun 27
0
Unimplemented feature in copyVector
Dear all,
I started a large run this afternoon, and when I came back after
dinner, three of five processes had stopped with the error message:
Error in matrix(nullprofile, length(nullprofile), nprofiles) :
Unimplemented feature in copyVector
I have seen anything about this anywhere (and I don't know where to
look...). As you might guess, I'm trying to make a matrix where the
2008 Jun 05
1
is() and S3 classes
The is() function begins with the following code:
cl <- class(object)
if (length(cl) > 1) {
if (is.na(match(cl[[1]], names(getClass("oldClass")@subclasses))))
return(class2 %in% cl)
As one can see, it uses S3 inheritance if the first element of the class
attribute is an "oldClass". In R prior to 2.7, is() would check S4
inheritance if any
2005 Aug 06
1
oldClass vs. class
Hi,When I read the source of str,i find these code
-----
## Show further classes // Assume that they do NOT have an own Method --
## not quite perfect ! (.Class = 'remaining classes', starting with current)
cl <- oldClass(object); cl <- cl[cl != "data.frame"] #- not THIS class
-----
so I use ?oldClass to try to learn more about oldClass.But after I have reading
2006 Dec 12
1
strings as factors
Hi,
To be able to match cases with a benchmark I need to have a data.frame with
a character id variable. however, I am surprised why this seems to be so
hard. In fact I was unable to succeed. Here is what I tried:
>test1 <-expand.grid(ID = 1:2, sex = c("male","female"))
>is(test1[,2])
[1] "factor" "oldClass"
>test2 <-expand.grid(ID =
2017 Nov 29
2
binary form of is() contradicts its unary form
Hi,
The unary forms of is() and extends() report that data.frame
extends list, oldClass, and vector:
> is(data.frame())
[1] "data.frame" "list" "oldClass" "vector"
> extends("data.frame")
[1] "data.frame" "list" "oldClass" "vector"
However, the binary form of is()
2006 Oct 09
0
dispatch on functions (was: Re: ifelse(logical, function1, function2) does not work)
On 10/7/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> I have noticed that dispatch on functions seems not to work
> in another case too. We define + on functions (I have ignored
> the niceties of sorting out the environments as we don't really
> need it for this example) but when we try to use it, it fails even
> though in the second example if we run it
2017 Nov 29
0
binary form of is() contradicts its unary form
Hi Herve,
I think you are confusing subclasses and classes. There is no
contradiction. `is` documentation
is very clear:
`With one argument, returns all the super-classes of this object's class.`
Note that object class is always `data.frame` here, check:
> class(data.frame())
[1] "data.frame"
> is(data.frame(), "data.frame")
[1] TRUE
Best,
Mehmet
On 29 Nov
2013 Feb 27
0
How to specify ff object filepaths when reading a CSV file into a ff data frame.
Really old subject?, so, all my apologizes for digging up
but, since I also ran into this? maybe this hack can be useful to someone
I propose monkey patching here:
library(ff)
my.as.ffdf.data.frame <- function (x, vmode = NULL, col_args = list(), ...)
{
rnam <- attr(x, "row.names")
if (is.integer(rnam)) {
if (all(rnam == seq_along(rnam)))
rnam <- NULL
else
2017 Jun 08
2
add_model paquete modeval
Estimados compañeros me gustaría saber si alguno ha utilizado la función
add_model del paquete modeval cuando la variable de clasificación (y)
tiene más de dos niveles. Porque si la utilizo con más niveles siempre
me sale el error:
Error: length(levels(factor((purrr::as_vector(y))))) == 2 is not TRUE Me
parece muy interesante el paquete y no veo donde indica esta limitación.
Un cordial
2017 Nov 29
0
binary form of is() contradicts its unary form
Hi Herve,
Interesting observation with `setClass` but it is for S4. It looks
like `data.frame()` is not an S4 class.
> isS4(data.frame())
[1] FALSE
And in your case this might help:
> is(asS4(data.frame()), "list")
[1] TRUE
Looks like `is` is designed for S4 classes, I am not entirely sure.
Best,
-Mehmet
On 29 November 2017 at 20:46, Herv? Pag?s <hpages at
2008 Jul 01
1
[.data.frame speedup
Below is a version of [.data.frame that is faster
for subscripting rows of large data frames; it avoids calling
duplicated(rows)
if there is no need to check for duplicate row names, when:
i is logical
attr(x, "dup.row.names") is not NULL (S+ compatibility)
i is numeric and negative
i is strictly increasing
"[.data.frame" <-
function (x, i, j,
2017 Nov 29
2
binary form of is() contradicts its unary form
Hi Mehmet,
On 11/29/2017 11:22 AM, Suzen, Mehmet wrote:
> Hi Herve,
>
> I think you are confusing subclasses and classes. There is no
> contradiction. `is` documentation
> is very clear:
>
> `With one argument, returns all the super-classes of this object's class.`
Yes that's indeed very clear. So if "list" is a super-class
of "data.frame" (as
2017 Nov 29
2
binary form of is() contradicts its unary form
Yes, data.frame is not an S4 class but is(data.frame())
finds its super-classes anyway and without the need to wrap
it in asS4(). And "list' is one of the super-classes. Then
is(data.frame(), "list") contradicts this.
I'm not asking for a workaround. I already have one with
'class2 %in% is(object)' as reported in my original post.
'is(asS4(object), class2)'
2002 Sep 13
1
design package (plot problems)
Hi,
just making some experiments with
design library i get an error if
i want plot(fit) - show below from
onlineHelp !?
..perhaps is here another mask problem?, but
label from xtable which was my first problem
is now off !
Thanks for advance & regards,
Christian
$ n <- 1000 # define sample size
$ set.seed(17) # so can reproduce the results
$ age <- rnorm(n, 50, 10)