Displaying 20 results from an estimated 4000 matches similar to: "[R] bug in unsplit()? (PR#1845)"
2002 Jul 28
1
[R] bug in unsplit()? (PR#1843)
Hedderik van Rijn <hedderik@cmu.edu> writes:
> If the second argument to unsplit is not a simple vector (but a "list
> containing multiple lists"), the function seems to have some problems.
>
> Given a slight modification of the examples in help(split):
>
> > xg <- split(x,list(g1=g,g2=g))
> > unsplit(xg,list(g1=g,g2=g))
> [1] -0.7877109
1999 Jan 04
1
Names of data frame columns in an apply
Hi,
[some background]
I have a dataset which describes a number of subjects doing a "scientific
discovery". That is, they have to discover the rules underlying a
particular domain. To do so, they have to set the levels of 5 variables
which leads to a certain outcome. To identify what kind of "experiments"
the subjects did, I want to combine these levels into one variable
2009 Nov 25
0
Possible bug in "unsplit" (PR#14084)
Dear R-bug-people
I have encountered a problem with "unsplit", which I believe may be
caused by a bug in the function. However, unexpericend with bug-reports
I apologise if this is barely a user problem rather than a problem
within R.
The problem occurs if an object is split by several grouping factors
with levels not occuring in the data, and using drop = TRUE. This may
appear as
2020 Nov 21
0
Error in unsplit() with tibbles
> On Nov 21, 2020, at 10:55 AM, Mario Annau <mario.annau at gmail.com> wrote:
>
> Hello,
>
> using the `unsplit()` function with tibbles currently leads to the
> following error:
>
>> mtcars_tb <- as_tibble(mtcars, rownames = NULL)
>> s <- split(mtcars_tb, mtcars_tb$gear)
>> unsplit(s, mtcars_tb$gear)
> Error: Must subset rows with a valid
2020 Nov 21
0
Error in unsplit() with tibbles
Cool - thank you Peter!
@Marc: This is really not a tidyverse vs base-R debate and I personally
think that they should both work together for most parts. The common
environment is still R. But just to give you the full picture I also filed
a bug for tibbles (https://github.com/tidyverse/tibble/issues/829). With
these two fixes I think that split/unsplit would work for tibbles and users
(like me)
2010 Apr 19
2
Using split and then unsplit
Hello everyone,
I use the split function splitting with the f function on a 3 columns and
more than 100 000 rows data frame. Once it's split I have a list of data
frames still with 3 columns and n rows. I manipulate those list elements and
get a list of data frames still with 3 columns but less rows. So when I
unsplit it, I get an error as I use the same factor function I used to split
( f in
2006 Jun 08
1
NAs in unsplit factor
R-devel,
Below is a simple example calling split and unsplit on a numeric
vector of length 2 where 'f' is c(1,NA).
> unsplit(split(c(1,2), c(1,NA)), c(1,NA))
[1] 1 0
I noticed that the call to vector in unsplit gives us 0 as the 2nd
element of the result.
Is this the intended result, as opposed to NA?
Thanks for your help,
Jeff
--
Jeff Enos
Kane Capital Management
jeff at
2009 May 08
1
unsplit list of data.frames with one column
Perhaps this is the intended behavior, but I discovered that unsplit
throws an error when it tries to set rownames of a variable that has
no dimension. This occurs when unsplit is passed a list of
data.frames that have only a single column.
An example:
df <- data.frame(letters[seq(25)])
fac <- rep(seq(5), 5)
unsplit(split(df, fac), fac)
For reference, I'm using R version 2.9.0
2005 Sep 27
2
Using unsplit - unsplit does not seem to reverse the effect of split
In data OME in MASS I would like to extract the first 5 observations per subject (=ID). So I do
library(MASS)
OMEsub <- split(OME, OME$ID)
OMEsub <- lapply(OMEsub,function(x)x[1:5,])
unsplit(OMEsub, OME$ID)
- which results in
[[1]]
[1] 1 1 1 1 1
[[2]]
[1] 30 30 30 30 30
[[3]]
[1] low low low low low
Levels: N/A high low
[[4]]
[1] 35 35 40 40 45
[[5]]
[1] coherent incoherent coherent
2020 Nov 21
3
Error in unsplit() with tibbles
Hello,
using the `unsplit()` function with tibbles currently leads to the
following error:
> mtcars_tb <- as_tibble(mtcars, rownames = NULL)
> s <- split(mtcars_tb, mtcars_tb$gear)
> unsplit(s, mtcars_tb$gear)
Error: Must subset rows with a valid subscript vector.
? Logical subscripts must match the size of the indexed input.
x Input has size 15 but subscript `rep(NA, len)` has
2004 Dec 09
3
US 2004 Elections map
even for people who didn't like the outcome of the US elections this
year, it must have been a joy to see all the nice (and not so nice)
graphs that were shown. As an exercise, I recreated the map shown on
the NY-Times website [
http://www.nytimes.com/packages/khtml/2004/11/03/politics/
20041103_px_ELECT_GRAPHIC.html ]
If you're interested,
2011 May 19
1
Problems with unsplit()
Hi everyone,
I have already used split() and unsplit() in data frames without problems,
but now I’m applying these functions to other data and when using unsplit()
I have received the following message:
Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "2", "3", "4", :
duplicate ''row.names'' are not allowed
In
2020 Nov 21
2
Error in unsplit() with tibbles
I get the sentiment, but this is really just bad coding (on my own part, I suspect), so we might as well just fix it...
-pd
> On 21 Nov 2020, at 17:42 , Marc Schwartz via R-devel <r-devel at r-project.org> wrote:
>
>
>> On Nov 21, 2020, at 10:55 AM, Mario Annau <mario.annau at gmail.com> wrote:
>>
>> Hello,
>>
>> using the `unsplit()`
1998 Jun 18
0
R-beta: netscape/R interaction [color allocation]
Thanks to Martin Maechler, Douglas Bates, Peter Dalgaard, and Hedderik van Rijn
for pointing out the problem is with the color resource demands of the two
applications and for their suggested possible solutions. A 24 bit monitor would
be ideal and maybe someday I'll have the $$$ to upgrade. "netscape -install"
works with the attendant flashing screen color changes from window to
1999 Jan 11
0
Bug in axis(...,tcl=0)?
Hi,
first of all, I would like to take this opportunity to thank all of you
"answer guys" for giving such detailed answers. I think I've learned about
as much from all these answers as from the different S/R documents I've
read so far.
Anyway, I ran into a incompatability between S and R, that is, R does not
know the "ticks=T/F" argument to functions like axis and
2001 Feb 23
0
Prevent killing an ESS *R* buffer unintentionally
A couple of days ago I posted some elisp code that asks the user for
confirmation before deleting a process buffer, e.g. the *R* buffer. However,
this code was only evaluated if a buffer was killed by means of [C-x k]. The
following code does not need to be bound to a particular key, it's
internally called by kill-buffer. (Also works if buffer is deleted in other
ways, e.g., [C-x C-c].)
2001 Feb 21
1
Specification of factors in tapply
After some fiddling around with the tapply command, I discovered that the
factors (the INDEX argument) given to tapply must be specified in
fastest-cycling first order.
The following code shows how I discovered my error: (R version 1.2.1)
-o-o-o-o-o-
x <- as.data.frame(list(data=c(-9,0,3,1,-9,1,0,-9,0,3,1,-9,1,0),
subj=c(rep(1,7),rep(2,7)),
2005 Jun 25
1
group means: split and unsplit
Took me a while but I figured out how to put in common values of
group means/counts, etc. to do the same thing as egen. lapply with
split and then unsplit.
Thomas Davidoff
Assistant Professor
Haas School of Business
UC Berkeley
Berkeley, CA 94720
phone: (510) 643-1425
fax: (510) 643-7357
davidoff@haas.berkeley.edu
http://faculty.haas.berkeley.edu/davidoff
[[alternative HTML
2003 Aug 10
1
read.spss doesn't work anymore
A couple of months ago, probably using an older version of R, R used to
run the following code just fine:
library("foreign")
data.exp1 <- as.data.frame(read.spss("dataDef.sav"))
Issuing the same commands now (after starting R using --vanilla), gives
me the following behavior:
> library("foreign")
> x <- read.spss("dataDef.sav")
Error
2002 Dec 20
3
Sweave & xtable
I'm trying to get Sweave running for automatic report generation, and
it seems to run fine when just using verbatim output. However, I've ran
into a problem with xtable. I would like to print the following matrix
using xtable:
> dim(counts)
[1] 19 15
All columns are filled with real/integer numbers > 0 and < 1000. Just
typing xtable(counts) gives correct LaTeX output, but