Displaying 20 results from an estimated 1000 matches similar to: "applying duplicated, unique and match to lists?"
2004 Aug 19
0
suggesting a new feature for unique()
Dear R-devel,
May I suggest that a new feature be added to a couple of unique() methods?
Sometimes it's useful to have the indices of the original data that the
unique elements come from, so that the original data can be recreated from
the unique()ed data. I suggest that an `index' argument be added for
unique. Below is a suggested patch against
R/src/library/base/R/duplicated.R:
***
2009 Mar 30
1
duplicated fails to rise correct errors (PR#13632)
Full_Name: Wacek Kusnierczyk
Version: 2.8.0 and 2.10.0 r48242
OS: Ubuntu 8.04 Linux 32 bit
Submission from: (NULL) (129.241.110.161)
In the following code:
duplicated(data.frame(), incomparables=NA)
# Error in if (!is.logical(incomparables) || incomparables)
.NotYetUsed("incomparables != FALSE") :
# missing value where TRUE/FALSE needed
the raised error is clearly not the
2018 Jul 02
1
MARGIN in base::unique.matrix() and base::unique.array()
Hi,
The man page for base::unique.matrix() and base::unique.array() says
that MARGIN is expected to be a single integer. OTOH the code in charge
of checking the user supplied MARGIN is:
if (length(MARGIN) > ndim || any(MARGIN > ndim))
stop(gettextf("MARGIN = %d is invalid for dim = %d",
MARGIN, dx), domain = NA)
which doesn't really make sense.
As
2011 Oct 05
1
unique possible bug
Hi,
I am trying to read in a rather large list of transactions using the
arules library. It seems in the coerce method into the dgCmatrix, it
somewhere calls unique. Unique.c throws an error when n > 536870912;
however, when 4*n was modified to 2*n in 2004, the overflow protection
should have changed from 2^29 to 2^30, right? If so, how would I
change it in my copy? Do I have to recompile
2008 May 08
1
[PATCH] Typo in 'unique' help page (PR#11401)
---
src/library/base/man/unique.Rd | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/library/base/man/unique.Rd b/src/library/base/man/unique.Rd
index a8397c7..4664a34 100644
--- a/src/library/base/man/unique.Rd
+++ b/src/library/base/man/unique.Rd
@@ -29,7 +29,7 @@ unique(x, incomparables = FALSE, \dots)
\item{x}{a vector or a data frame or an array or
2013 Oct 30
1
unique(1:3,nmax=1) freezes R
Dear all,
I was playing around with factor contrasts, and found the argument nmax on function factor. When using nmax=1, R froze completely, and I had to close it from task manager. After some debugging, I found that the problem is actually in unique-function, where the internal unique function is called:
.Internal(unique(x, incomparables, fromLast, nmax))
More generally, it looks like
2012 Sep 27
3
Keep rows in a dataset if one value in a column is duplicated
Hi,
I have a data set of observations by either one person or a pair of people.
I want to only keep the pair observations, and was using the code below
until it gave me the error " $ operator is invalid for atomic vectors". I am
just beginning to learn R, so I apologize if the code is really rough.
Basically I want to keep all the rows in the data set for which the value of
2010 Jan 16
2
Extracing only Unique Rows based on only 1 Column
To Whomever is Interested,
I have spent several days searching the web, help files, the R wiki
and the archives of this mailing list for a solution to this problem,
but nonetheless I apologize in advance if I have missed something
obvious.
The problem is this; I have a 5-column data frame with about 4.2
million rows, and want to create a new (and hopefully much smaller)
data frame that
2005 Nov 23
4
x[1,], x[1,,], x[1,,,], ...
Hi,
is there a function in R already doing what I try to do below:
# Let 'x' be an array with *any* number of dimensions (>=1).
x <- array(1:24, dim=c(2,2,3,2))
...
x <- array(1:24, dim=c(4,3,2))
i <- 2:3
ndim <- length(dim(x))
if (ndim == 1)
y <- x[i]
else if (ndim == 2)
y <- x[i,]
else if (ndim == 3)
y <- x[i,,]
else ...
and so on. My current
2002 May 30
1
problem of compile fortran program
I want to call dll from R but encounter problem in compiling the fortran
program.
First I try "Rcmd shlib prog.f", it failed and warning:
make[1]: `libR.a' is up to date.
make: *** No rule to make target `'prog.o', needed by `prog.a'. stop.
Then I try to compile it by absoft fortran compiler, it works and produces
prog.dll.
But when this routine is called in R, it
2008 Sep 12
1
match and incomparables
Hello,
I was playing around with the newly implemented 'incomparables' argument
in 'match' and realized the argument does not behave anything like I
expected. Can someone explain what is going on here? Sorry if I'm
misreading the documentation.
> match(1:3, 1:3, incomparables=1)
[1] NA 2 3 # This seems right, the 1 in 'x' is 'incomparable'
>
2008 Mar 12
1
Problem when calling FORTRAN subroutine (dll)
Hello,
I am trying to call a FORTRAN subroutine from R. The Fortran code is @:
http://lib.stat.cmu.edu/apstat/206
It performs a bivariate isotonic regression on a rectangular grid (m X n) matrix. I used the g77 compiler and successfully created a dll file and it also loads successfully from R. But somehow the programs fails to run properly. (I do get the correct result when I compile the
2012 Jul 23
1
duplicated() variation that goes both ways to capture all duplicates
Dear all
The trouble with the current duplicated() function in is that it can
report duplicates while searching fromFirst _or_ fromLast, but not
both ways. Often users will want to identify and extract all the
copies of the item that has duplicates, not only the duplicates
themselves.
To take the example from the man page:
> data(iris)
> iris[duplicated(iris), ] ##duplicates while
2004 May 27
1
R-1.9.0: Error in paste(ncomp, "LV's") : Argument "ncomp" is missing, with no default
Is it just my installation or bug in 1.9.0 ?
The same thing works fine in 1.8.1
Best regards,
Ryszard
# R-1.9.0
library(pls.pcr)
nr <- 8; ndim <- 2
x <- matrix(rnorm(nr*ndim), nrow=nr)
y <- as.matrix(x[,1])
for (i in 2:ndim) y <- y + x[,i]
y <- y + rnorm(length(y))
m <- pls(x,y,validation='CV')
# Error in paste(ncomp, "LV's") : Argument
2011 Mar 27
1
run function on subsets of matrix
I was wondering if it is possible to do the following in a smarter way.
I want get the mean value across the columns of a matrix, but I want
to do this on subrows of the matrix, given by some vector(same length
as the the number of rows). Something like
nObs<- 6
nDim <- 4
m <- matrix(rnorm(nObs*nDim),ncol=nDim)
fac<-sample(1:(nObs/2),nObs,rep=T)
##loop trough different
2011 Feb 16
1
Timeseries Data Plotted as Monthly Boxplots
Hello, I'm trying to develop a box plot of time series data to look at the
range in the data values over the entire period of record.
My data initially starts out as a list of hourly data, and then I've been
using this code to make this data into the final ts array.
# Read in the station list
stn.list <- read.csv("/home/kbennett/fews/stnlist3", as.is=T, header=F)
# Read in
2001 Jul 20
2
angle/density in barplots/polygon
I'm trying to convert some S-Plus code which generates barplots and
other shaded area plots to R. If I specify that I want hatching
using the angle and density arguments, the messages
1: argument `density' is not used (yet) in: .NotYetUsed("density", error = FALSE)
2: argument `angle' is not used (yet) in: .NotYetUsed("angle", error = FALSE)
so apparently these
2011 Dec 17
0
time-varying parameters kalman filter estimation problem using FKF package
Dear R users,
I am trying to carry out MLE of the time-varying CAPM using the FKF package.
My approach so far has been to try and adapt the example given in the help
file found using ?fkf which demonstrates the MLE of an ARMA(2,1) model.
When I attempt to run my R code (given below) I get the following error:
Error in fkf(a0 = sp$a0, P0 = sp$P0, dt = sp$dt, ct = sp$ct, Tt = sp$Tt, :
Some of
2008 Aug 29
3
wine rejecting keyboard input when window not focused
I'm wondering if theres a way to disable it, I made a program which broadcasts keystrokes between multiple windows (see the source here, http://www.nomorepasting.com/getpaste.php?pasteid=19683 ) This program works fine in everything, except wine. It works fine in wine too, but only when the window is focused.
This makes me think that wine is rejecting the keyboard input, purely because the
2007 Mar 28
1
warnings on adapt
Hi all
I was wondering if someone could help me.
I have to estimate some parameters, so I am using the function nlm. Inside
this function I have to integrate, hence
I am using the function adapt.
I don't understand why it is giving the following warnings:
At the beginning:
Warning: a final empty element has been omitted
the part of the args list of 'c' being evaluated was: