Hi--I'm fairly new to R and trying to do a text mining project on a novel
using the tidytext package. The novel is saved as a plain text document and
I can import it into RStudio just fine. For reference I'm trying to do
something similar to section 1.3 of this tidy text tutorial
You can use save(ascii=TRUE,...) to make an ascii-only RData file that you
can include in the mail message. E.g.,
> x <- c(3.4, 3.4 + 1e-15)
> save(x, ascii=TRUE, file=stdout())
RDA3
A
3
198145
197888
5
UTF-8
1026
1
262153
1
x
14
2
3.4
3.401
254
Bill Dunlap
TIBCO Software
wdunlap
Thanks a lot, it answers my question.
Alain
De : Jeff Newmiller
Envoy� : mardi 10 d�cembre 2019 16:31
� : r-help@r-project.org ; Duncan Murdoch
; Alain Guillet ;
r-help@r-project.org
Objet : Re: [R] table and unique seems to behave differently
I think the
On 10/12/2019 10:32 a.m., Sarah Goslee wrote:
Back to the table part of the question, but using Duncan's example.
x <- c(3.4, 3.4 + 1e-15)
unique(x)
[1] 3.4 3.4
table(x)
x
3.4
2
The question was, why are these different.
table() only works on factors, so it converts the numeric vector
Another finding for me today: dput doesn't write exactly the vector that
creates the problem. I could use an RData file but I think it is forbidden in
this mailing list...
Alain
De : Chris Evans
Envoy� : mardi 10 d�cembre 2019 15:41
� : Alain Guillet
Cc :
Back to the table part of the question, but using Duncan's example.
> x <- c(3.4, 3.4 + 1e-15)
> unique(x)
[1] 3.4 3.4
> table(x)
x
3.4
2
The question was, why are these different.
table() only works on factors, so it converts the numeric vector to a
factor before tabulation.
factor() tries
I think the question was about table vs unique. Table groups by character
representation, unique groups by the underlying representation.
On December 10, 2019 7:03:34 AM PST, Duncan Murdoch
wrote:
>On 10/12/2019 3:53 a.m., Alain Guillet wrote:
>> Hi,
>>
>> I have a vector (see below the dput)
On 10/12/2019 3:53 a.m., Alain Guillet wrote:
Hi,
I have a vector (see below the dput) and I use unique on it to get unique values. If I
then sort the result of the vector obtained by unique, I see some elements that look like
identical. I suspect it could be a matter of rounded values but
This doesn't answer your question but I get exactly the same vector of length
210 with unique(toto) and names(table(toto)) using the same version of R that
you are and I can't see any obvious reason why you wouldn't but when I hit
things like that it tends to be that one version is string with
Hi,
I have a vector (see below the dput) and I use unique on it to get unique
values. If I then sort the result of the vector obtained by unique, I see some
elements that look like identical. I suspect it could be a matter of rounded
values but table gives a different result: unlike unique
Here is a test of the different proposed solutions and a new one faster.
In conclusion, ifelse much be used with caution:
Aini = runif(100, min=-1,max=1)
library(microbenchmark)
A <- Aini
microbenchmark({B1 <- ifelse( A < 0, sqrt(-A), A )})
# mean = 77.1
A <- Aini
microbenchmark({B2 <-
11 matches
Mail list logo