Displaying 20 results from an estimated 3000 matches similar to: "rbind has confusing result for custom sub-class (possible bug?)"
2019 May 26
2
rbind has confusing result for custom sub-class (possible bug?)
On Sun, May 26, 2019 at 4:06 AM Michael Chirico
<michaelchirico4 at gmail.com> wrote:
>
> Have finally managed to come up with a fix after checking out sys.calls()
> from within the as.Date.IDate debugger, which shows something like:
>
> [[1]] rbind(DF, DF)
> [[2]] rbind(deparse.level, ...)
> [[3]] `[<-`(`*tmp*`, ri, value = 18042L)
> [[4]] `[<-.Date`(`*tmp*`,
2019 May 27
2
rbind has confusing result for custom sub-class (possible bug?)
Yes, thanks for following up on thread here. And thanks again for clearing
things up, your email was a finger snap of clarity on the whole issue.
I'll add that actually it was data.table's code at fault on the storage
conversion -- note that if you use an arbitrary sub-class 'foo' with no
methods defined, it'll stay integer.
That's because [<- calls as.Date and then
2019 Jun 02
1
rbind has confusing result for custom sub-class (possible bug?)
I thought it would be good to summarize my thoughts, since I made a
few hypotheses that turned out to be false.
This isn't a bug in base R, in either rbind() or `[<-.Date`.
To summarize the root cause:
base::rbind.data.frame() calls `[<-` for each column of the
data.frame, and there is no `[<-.IDate` method to ensure the
replacement value is converted to integer. And, in fact,
2019 May 27
0
rbind has confusing result for custom sub-class (possible bug?)
On Sun, May 26, 2019 at 6:47 AM Joshua Ulrich <josh.m.ulrich at gmail.com> wrote:
>
> On Sun, May 26, 2019 at 4:06 AM Michael Chirico
> <michaelchirico4 at gmail.com> wrote:
> >
> > Have finally managed to come up with a fix after checking out sys.calls()
> > from within the as.Date.IDate debugger, which shows something like:
> >
> > [[1]]
2019 May 27
0
rbind has confusing result for custom sub-class (possible bug?)
Follow-up (inline) on my comment about a potential issue in `[<-.Date`.
On Mon, May 27, 2019 at 9:31 AM Michael Chirico
<michaelchirico4 at gmail.com> wrote:
>
> Yes, thanks for following up on thread here. And thanks again for clearing things up, your email was a finger snap of clarity on the whole issue.
>
> I'll add that actually it was data.table's code at fault
2019 May 26
0
rbind has confusing result for custom sub-class (possible bug?)
Have finally managed to come up with a fix after checking out sys.calls()
from within the as.Date.IDate debugger, which shows something like:
[[1]] rbind(DF, DF)
[[2]] rbind(deparse.level, ...)
[[3]] `[<-`(`*tmp*`, ri, value = 18042L)
[[4]] `[<-.Date`(`*tmp*`, ri, value = 18042L)
[[5]] as.Date(value)
[[6]] as.Date.IDate(value)
I'm not sure why [<- is called, I guess the
2010 Aug 05
1
rbind on data.frame that contains a column that is also a data.frame
Hi,
The following was already a topic on r-help, but after understanding what is
going on, I think it fits better in r-devel.
The problem is this:
When a data.frame has another data.frame in it, rbind doesn't work well.
Here is an example:
--
> a=data.frame(x=1:10,y=1:10)
> b=data.frame(z=1:10)
> b$a=a
> b
z a.x a.y
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
5
2017 Jan 17
2
bug in rbind?
I suspect there may be a bug in base::rbind.data.frame
Below there is minimal example of the problem:
m <- matrix (1:12, 3)
dfm <- data.frame (c = 1 : 3, m = I (m))
str (dfm)
m.names <- m
rownames (m.names) <- letters [1:3]
dfm.names <- data.frame (c = 1 : 3, m = I (m.names))
str (dfm.names)
rbind (m, m.names)
rbind (m.names, m)
rbind (dfm, dfm.names)
#not working
rbind
2007 Jan 25
4
rbind-ing with empty data frame produces error
Hi all,
I'm having some trouble with rbind - this may be a bug or it may be my
misunderstanding. If I do
fileName <- paste(tempdir(),"test.txt",sep="/")
file.create(fileName)
x <- read.table(fileName, col.names=c("one","two","three"))
I get a data frame with no rows, as documented. If I then try to rbind
this with another data frame
2017 May 23
2
Inconsistency in handling of numeric input with %d by sprintf
https://github.com/Rdatatable/data.table/issues/2171
The fix was easy, it's just surprising to see the behavior change almost on
a whim. Just wanted to point it out in case this is unknown behavior, but
Evan seems to have found this as well.
On Tue, May 23, 2017 at 12:00 PM, Michael Chirico <michaelchirico4 at gmail.com
> wrote:
> Astute observation. And of course we should be
2017 May 23
2
Inconsistency in handling of numeric input with %d by sprintf
I initially thought this is "documented behaviour". ?sprintf says:
Numeric variables with __exactly integer__ values will be coerced to
integer. (emphasis mine).
Turns out this only works when the first value is numeric and not NA, as
shown by the following example:
> sprintf("%d", as.numeric(c(NA,1)))
Error in sprintf("%d", as.numeric(c(NA, 1))) :
invalid
2007 Aug 29
4
How to signal the end of the table?
I am using a "for" loop to read a table row by row and I have to specify how
many records are there in the table. I need to read row by row because the
table is huge and the memory not large enough for the whole table.:
number.of.records=100
fp=file("abc.csv","r")
pos=seek(fp, rw="read")
for (i in 1:number.of.record){
current.row=scan(file=fp,
2017 May 19
2
Inconsistency in handling of numeric input with %d by sprintf
Consider
#as.numeric for emphasis
sprintf('%d', as.numeric(1))
# [1] "1"
vs.
sprintf('%d', NA_real_)
> Error in sprintf("%d", NA_real_) :
invalid format '%d'; use format %f, %e, %g or %a for numeric object
>
I understand the error is correct, but if it works for other numeric input,
why doesn't R just coerce NA_real_ to NA_integer_?
2006 Jun 26
3
syntax for observe_field( :with =>
Greetings!
What is up with the syntax of this thing? I mean, if the only thing I can send back using :with is the field being observed, then why in the world is the syntax so convoluted? For example, what I''ve been able to get working is:
<%= text_field_tag(''date'', illness_date, :size => 30) %></p>
<%= observe_field(''date'', :url
2018 Feb 27
2
scale.default gives an incorrect error message when is.numeric() fails on a sparse row matrix (dgeMatrix)
I am attempting to use the lars package with a sparse input feature matrix,
but the following fails:
library(Matrix)
library(lars)
data(diabetes)
attach(diabetes)
x = as(as.matrix(as.data.frame(x)), 'dgCMatrix')
lars(x, y, intercept = FALSE)
Error in scale.default(x, FALSE, normx) :
>
> length of 'scale' must equal the number of columns of 'x'
>
>
More
2020 Apr 30
1
Translations and snprintf on Windows
[a bit unsure on if this is maybe better for r-package-devel]
We recently added translations to messages at the R and C level to
data.table.
At the C level, we did _() wrapping for char arrays supplied to the
following functions: error, warning, Rprintf, Error, and snprintf.
This seemed OK but the use of snprintf specifically appears to have caused
a crash on Windows:
2020 Nov 15
2
Trabajar con fechas y data.table
Cosas como IDate est?n a?n en modo experimental, haces uso de esas funciones?
Obtener Outlook para Android<https://aka.ms/ghei36>
________________________________
From: Carlos Ortega <cof en qualityexcellence.es>
Sent: Sunday, November 15, 2020 8:27:43 AM
To: Jes?s Para Fern?ndez <j.para.fernandez en hotmail.com>
Cc: r-help-es en r-project.org <r-help-es en r-project.org>
2020 Apr 03
5
[supermin PATCH 0/4] Check for output results for --if-newer (RHBZ#1813809)
This is an attempt to make supermin check for the existing results of an
output when checking whether the appliance must be rebuilt using
--if-newer.
At the moment it is implemented only for the build mode, and for its
ext2 output format.
Pino Toscano (4):
build: factor ext2 filenames
Tighten Unix_error check for missing outputdir
Extend modes with list of outputs
build: set
2010 Mar 26
2
R loop help
Hi,
I am tring to write a loop to compute this,
==========================
x1=c(
rep(-1,4),
rep(1,4)
)
x2=c(
rep(c(-1,-1,1,1),2)
)
x3=c(
rep(c(-1,1),4)
)
x1*x2
x1*x3
x2*x3
========================
suppose i have x1,x2,x3
i want to compute their ' two factor interactions', x1x2,x1x3 and x2x3,
I wrote
========================
for(i in 1:2){
for( j in i+1:3){
xij=c()
2020 Oct 19
1
usage of #import in grDevices/src/qdCocoa.h
I happened to notice that this header file uses
#import <Cocoa/Cocoa.h>
This is the first time I came across the preprocessor directive #import;
the first thing I found about it is this Q&A suggesting it's not portable
nor standard C:
https://stackoverflow.com/q/39280248/3576984
On the other hand, this exact invocation seems pretty common on GitHub