Hi,
>From the dscription, looks like you need ?rle()
vec1 <- c(111, 106, 117, 108, 120, 108, 108, 116, 116, 113)
res <- rle(vec1)$lengths
names(res) <- rle(vec1)$values
res[res>1]
#108 116
# 2 2
length(res[res>1])
A.K.
On Thursday, November 21, 2013 10:12 AM, b. alzahrani
wrote:
If you just need a count of how many of each number you can just use
table().
> tmp <- c(111,106,117,108,120,108,108,116,113)
> table(tmp)
tmp
106 108 111 113 116 117 120
1 3 1 1 1 1 1
On Thu, Nov 21, 2013 at 9:10 AM, b. alzahrani wrote:
>
> hi guys
>
> Assume I have this data
Thanks, got it.
**
Bander Alzahrani, r
*
Date: Thu, 21 Nov 2013 09:14:11 -0600
Subject: Re: [R] frequency of numbers
From: deter...@umn.edu
To: cs_2...@hotmail.com
CC: r-help@r-project.org
If
hi guys
Assume I have this dataframe:
v3$number_of_ones
[1] 111 106 117 108 120 108 108 116 116 113
Is there any command in r that gives me the frequency of these numbers (how
many each number is repeated e.g. the number 108 repeated 2 and 111 repeated
one an so on)
I have around 10^6 numb
Julius -
Both mag and i are vectors, but of different lengths.
R interprets the statement mag>=i as "return a vector the
same length as mag and i whose elements compare the
corresponding elements of the two vectors." The error
message is due to the fact that mag and i are of different
lengt
Hi,
I have two vectors, mag and i, and I want to generate a of vector where each
element is the frequency of mag which is greater than i.
i produced the following code. However I get the following error:
mag<-rnorm(40,5,3)
i<-seq(floor(min(mag)),max(mag), 0.5)
freq<-sum(mag>=i)
Warning messag
6 matches
Mail list logo