Displaying 20 results from an estimated 2000 matches similar to: "question about setdiff()"
2004 Feb 27
4
question
Hi everybody.
The question:
I get two vectors 'iFalseFalse' and 'i2'.
I think they should be the same but they are not.
Is it because
R does not handle complicated logical expressions in such cases
or I do something wrong?
> z1 = c(NA, "", 3, NA, "", 3)
> z2 = c("", "", 3, NA, 3, NA)
> cV = (as.character(z1)==as.character(z2))
2004 Feb 05
2
correction to the previously asked question (about merging factors)
I have two factors l1, l2, and I'd like to merge them.
(Remark: The factors can not be converted to charaters)
Function c() does not give me the result I want:
> l1 = factor(c('aaaa', 'bbbb'))
> l2 = factor(c('ccc', 'dd'))
> lMerge = factor(c(l1, l2))
> lMerge
[1] 1 2 1 2
Levels: 1 2
>
I'd like to merge l1 and l2 and to get lMerge
2004 Feb 27
2
question about if else
Today is a good day for asking question, I guess.
> c()
NULL
>
> length(c())==0
[1] TRUE
>
> r = ifelse(length(c())!=0, c(), c(1,2)) ### OK
> r = c() ### OK
> r = ifelse(length(c())==0, c(), c(1,2)) ### why this is not OK (given
> the previous two)?
Error in "[<-"(`*tmp*`, test, value = rep(yes, length =
2004 Feb 18
6
interesting feature
Hi, everybody.
This was an interesting discussion last time and it helped me a lot.
Could you please have a look at some feature and tell me
why it was designed this way
(my questions are under #########)
> x = c(1, 10)
> y = c(99, 55)
> d <- data.frame(x = x, y = y)
> d
x y
1 1 99
2 10 55
> add <- data.frame(x = 14, y = 99)
> add
x y
1 14 99
> d <-
2004 Feb 05
1
What is the correct way of using function C() for factors:
The funciton c() works differently for strings and for factors:
For strings:
> l = c('a', 'b')
> l
[1] "a" "b"
For factors:
> l = c(factor('a'), factor('b'))
> l
[1] 1 1
What should be the right technique for merging factors?
--
Svetlana Eden Biostatistician II School of Medicine
2009 May 30
3
setdiff bizarre (was: odd behavior out of setdiff)
Dear R-devel,
Please see the recent thread on R-help, "Odd Behavior Out of
setdiff(...) - addition of duplicate entries is not identified" posted
by Jason Rupert. I gave an answer, then read David Winsemius' answer,
and then did some follow-up investigation.
I would like to change my answer.
My current version of setdiff() is acting in a way that I do not
understand, and a way
2009 May 30
3
setdiff bizarre (was: odd behavior out of setdiff)
Dear R-devel,
Please see the recent thread on R-help, "Odd Behavior Out of
setdiff(...) - addition of duplicate entries is not identified" posted
by Jason Rupert. I gave an answer, then read David Winsemius' answer,
and then did some follow-up investigation.
I would like to change my answer.
My current version of setdiff() is acting in a way that I do not
understand, and a way
2004 Mar 26
1
lookup.xport in foreign ignoring some datasets (PR#6701)
The Details.
In the following version.
> version
_
platform i386-pc-linux-gnu
arch i386
os linux-gnu
system i386, linux-gnu
status
major 1
minor 8.1
year 2003
month 11
day 21
language R
>
lookup.xport ignores some datasets in sas export file.
File "emptySasData3.xpt"
(available at http://biostat.mc.vanderbilt.edu/tmp/emptySasData3.xpt)
is a
2009 May 29
2
Odd Behavior Out of setdiff(...) - addition of duplicate entries is not identified
I think I am using the improved version of setdiff(...) that handles data.frames, so I think some odd behavior was expected but this one is escaping me.
It appears that the the addition of duplicate entries is not caught by the setdiff(...). Is this expected behavior?
If so, is there another method or approach that should be used to identify duplicate row entries between two different data
2007 Dec 10
1
setdiff for data frames
Hello,
I have been interested in setdiff() for data frames that operates
row-wise. I looked in the documentation, mailing lists, etc., and
didn't find exactly the right thing. Given data frames A, B with the
same columns, the goal is to extract the rows that are in A, but not
in B. Of course, one can usually do setdiff(rownames(A), rownames(B))
but that is cheating. :-)
I played around a
2004 Feb 24
1
bug in ifelse (PR#6611)
> version
_
platform i386-pc-linux-gnu
arch i386
os linux-gnu
system i386, linux-gnu
status
major 1
minor 8.1
year 2003
month 11
day 21
language R
> aa <- as.POSIXct(c('1/1/1980','1/2/1980',''))
> ifelse(is.na(aa),as.POSIXct('1/3/1980'),aa)
Error in rep.int(unclass(x), times) : Argument "times" is missing,
2013 Feb 01
2
how to setdiff on lists of lists
Dear List,
I have a data structure like:
> aa
[[1]]
[1] 1 2 3
[[2]]
[1] 4 5 6
> bb
[[1]]
[1] 3
[[2]]
[1] 5
I would like to set differences between "aa" and "bb" and get as
result another list of lists like:
> res
[[1]]
[1] 1 2
[[2]]
[1] 4 6
I am trying:
lapply(aa, setdiff, bb)
but I simply get "aa" back as result. Could you please point me in the
2013 Jul 18
3
setdiff y/o intersect para diferencias entre vectores
hola,
tengo dos vectores de 1134 y 385 elementos que se corresponden con números de accesión de genes. Necesito saber que números son comunes o intersección de vectores.
He utilizado intersect(x,y) y me da todo el rato un único valor:
V1 V1.1 V1.2 V1.3 V1.4 V1.5 V1.6 V1.7 V1.8 V1.9 V1.10 V1.11 V1.12
1 AJ558305 AJ558305 AJ558305 AJ558305 AJ558305
2013 Jul 23
0
setdiff y/o intersect para diferencias entre vectores
Hola Marcos.
Yo probaría algo del estilo a esto....
Intersecc<-v1[v1%in%v2]
Un saludo,
_____________________________
Miguel Ángel Rodríguez Muíños
Dirección Xeral de Innovación e Xestión da Saúde Pública
Consellería de Sanidade
Xunta de Galicia
http://dxsp.sergas.es
-----Mensaje original-----
De: r-help-es-bounces en r-project.org [mailto:r-help-es-bounces en r-project.org] En nombre
2010 Jul 29
4
looking for setdiff equivalent on dataset
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?...
Nom : non disponible
URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20100729/2fc86d3d/attachment.pl>
2012 Aug 14
1
Can we interlink these three if conditions?
key1.=c(1, 2, 3)
key2.=c(2)
if (identical(key1.,key2.) == "TRUE") {
cat("No Errors found")
}
if (length(setdiff(key1., key2.)) !=0) {
1999 Jul 20
2
tensor() function and sets
Hi Everyone,
To complete the outer() and kronecker() functions in the base, may I
suggest the following tensor() function, which allows the multiplication
of arrays through sets of conformable dimensions. I am happy to write a
help page if required.
The code also needs a setdiff() function which prompts me to ask: what
about simple set functions? I expect many of us have written our own
2009 Apr 04
1
comparing columns in a dataframe
hello,
I am hoping for some advice regarding comparing variables from 3
versions of a spreadsheet which have been combined into a single
dataframe. The aim is to identify which rows have been changed.
The dataframe contains 177 rows of data (each cell contains text).
'intersect' produced a file with 35 rows, 'union' a file with 303
rows and 'setdiff' a file with 130
2012 Jan 15
2
determining the difference between 2 character strings
Hi,
I am struggling, I have 2 lists with shared elements, one ~600, one
~1000, and I need to determine the difference between them.
They are character strings, and to use setdiff(), or unique() I need
vectors. I don't know how to force these character strings into a form
where you can use functions like setdiff(). Any help would be greatly
appreciated.
> head(R1)
[1]
2012 Jun 25
2
setdiff datframes
hi,
I have 2 files example 1 and example 2 and would like to know what is in
example2 and not in example1 (attached)
V1 contain data which could be in duplicated which I am using as identifiers
I used setdiff(example2$V1,example1$V1) to find the identifiers which
are specific to example2:
[1] "rs2276598" "rs17253672"
I am looking for a way to get an output with all