Displaying 20 results from an estimated 9000 matches similar to: "bug in rbind?"
2017 Jan 21
0
bug in rbind?
I'm not sure whether or not this is a bug, but I did isolate the line
where the error is thrown:
src/library/base/R/dataframe.R:1395.
https://github.com/wch/r-source/blob/01374c3c367fa12f555fd354f735a6e16e5bd98e/src/library/base/R/dataframe.R#L1395
The error is thrown because the line attempts to set a subset of the
rownames to NULL, which fails.
R> options(error = recover)
R>
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
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
2019 May 26
2
rbind has confusing result for custom sub-class (possible bug?)
Debugging this issue:
https://github.com/Rdatatable/data.table/issues/2008
We have custom class 'IDate' which inherits from 'Date' (it just forces
integer storage for efficiency, hence, I).
The concatenation done by rbind, however, breaks this and returns a double:
library(data.table)
DF = data.frame(date = as.IDate(Sys.Date()))
storage.mode(rbind(DF, DF)$date)
# [1]
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,
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 Jun 04
0
New var
# read.table is NOT part of the data.table package
#library(data.table)
DFM <- read.table( text=
'obs start end
1 2/1/2015 1/1/2017
2 4/11/2010 1/1/2011
3 1/4/2006 5/3/2007
4 10/1/2007 1/1/2008
5 6/1/2011 1/1/2012
6 10/5/2004 12/1/2004
',header = TRUE, stringsAsFactors = FALSE)
# cleaner way to compute D
DFM$start <- as.Date( DFM$start, format="%m/%d/%Y" )
DFM$end
2017 Jun 04
0
New var
Since the number of choices is small (6), how about this?
Starting with Jeff's initial DFM:
DFM <- structure(list(obs = 1:6, start = structure(c(16467, 14710, 13152,
13787, 15126, 12696), class = "Date"), end = structure(c(17167,
14975, 13636, 13879, 15340, 12753), class = "Date"), D = c(700,
265, 484, 92, 214, 57), bin = structure(c(6L, 3L, 5L, 1L, 3L,
1L), .Label
2017 Jun 04
2
New var
Thank you Jeff and All,
Within a given time period (say 700 days, from the start day), I am
expecting measurements taken at each time interval;. In this case "0" means
measurement taken, "1" not taken (stopped or opted out and " -1" don't
consider that time period for that individual. This will be compared with
the actual measurements taken (Observed-
2011 Aug 27
2
Am having trouble calling a function
In my main R program, I have
source("retaanalysis/Functions/doAirport.R")
.... stuff to read data and calculate ads
sapply(ads, function(x) {doAirport(x, base)} )
And doAirport has
# analyze the flights for a given airport
doAirport = function(df, base) {
# Get rid of unused runway factor levels (from other airports)
df$lrw <- drop.levels(df$lrw) # In gdata package
#
2017 Jul 16
0
About doing figures
Hi lily,
As I have no idea of what the "true record" is, I can only guess.
Maybe this will help:
# get some fairly distinct colors
rainbow_colors<-rainbow(9)
# this should sort the numbers in dfm$A
dfm$Acolor<-factor(dfm$A)
plot(dfm$B,dfm$C,pch=ifelse(dfm$DF==1,1,19),
col=rainbow_colors[as.numeric(dfm$Acolor)])
legend("bottom",legend=sort(unique(dfm$A)),
2017 Jul 16
2
About doing figures
Hi Jim,
For true color, I meant that the points in the figure do not correspond to
the values from the dataframe. Also, why to use rainbow(9) here? And the
legend is straight in the middle, is it possible to reformat it to the very
bottom? Thanks again.
On Sun, Jul 16, 2017 at 2:50 AM, Jim Lemon <drjimlemon at gmail.com> wrote:
> Hi lily,
> As I have no idea of what the "true
2017 Jul 16
0
About doing figures
For more than 10 records, how to reformat the colors? Also, how to show the
first legend only, but at the bottom, while the second legend in your code
is not necessary? In all, the same A values have the same color, but
different symbols in DF==1 and DF==2.
Thanks for your help.
On Sun, Jul 16, 2017 at 9:28 AM, lily li <chocold12 at gmail.com> wrote:
> Hi Jim,
>
> For true color,
2011 Nov 28
1
Comparing data
Hi all,
i have a data set cintaining 14 columns and 11 rows. Rows represent single point and columns represent the parameter measured.
I wiuld like to compare the data to see which are more alike. I used the cluster analysis, but now i ma wondering if there are some other methods, since the cluster analysis did not give me the result i like.
I tried to use factanal() for factor analysis
2017 Jul 16
2
About doing figures
Hi R users,
I still have the problem about plotting. I wanted to put the datasets on
one figure, x-axis represents values B, y-axis represents values C, while
different colors label column A. Each record uses a circle on the figure,
while hollow circles represent DF=1 and solid circles represent DF=2. I put
my code below, but the A labels do not correspond to the true record, so I
don't know
2014 Mar 06
1
Create dataframe in C from table and return to R
Hi ,
I am trying to create a dataframe in C and sebd it back to R. Can anyone
point me to the part of the source code where it is doing , let me explain
the problem I am having .
--------------------------------------------------------------------
My simple implementation is like this
SEXP formDF() {
SEXP dfm ,df , dfint , dfStr,lsnm;
char *ab[3] =
2017 Jun 03
2
New var
Thank you all for the useful suggestion. I did some of my homework.
library(data.table)
DFM <- read.table(header=TRUE, text='obs start end
1 2/1/2015 1/1/2017
2 4/11/2010 1/1/2011
3 1/4/2006 5/3/2007
4 10/1/2007 1/1/2008
5 6/1/2011 1/1/2012
6 10/5/2004 12/1/2004',stringsAsFactors = FALSE)
DFM
DFM$D =as.numeric(difftime(as.Date(DFM$end,format="%m/%d/%Y"),
2023 May 25
1
data.frame with a column containing an array
So is this an expected behavior or is it a bug which should be reported somewhere else?
Thanks!
Georg?
?
?
Gesendet:?Dienstag, 09. Mai 2023 um 19:28 Uhr
Von:?"Bert Gunter" <bgunter.4567 at gmail.com>
An:?"Georg Kindermann" <Georg.Kindermann at gmx.at>
Cc:?"Rui Barradas" <ruipbarradas at sapo.pt>, r-help at r-project.org
Betreff:?Re: [R] data.frame
2023 May 09
1
data.frame with a column containing an array
I think the following may provide a clearer explanation:
subs <- c(1,3)
DFA <- data.frame(id = 1:3)
ar <- array(1:12, c(3,2,2))
## yielding
> ar
, , 1
[,1] [,2]
[1,] 1 4
[2,] 2 5
[3,] 3 6
, , 2
[,1] [,2]
[1,] 7 10
[2,] 8 11
[3,] 9 12
## array subscripting gives
> ar[subs,,]
, , 1
[,1] [,2]
[1,] 1 4
[2,] 3 6
, , 2