[R] (no subject)

Clint Bowman clint at ecy.wa.gov
Wed Oct 30 19:09:38 CET 2013


Just guessing, would the following help?

list1 <- c("john", "eric", "steve", "john", "eric", "scott", "john")
list2 <- c("john", "john", "john", "eric", "eric", "steve", "scott")
max(rle(list1)$lengths)
max(rle(list2)$lengths)

Clint

Clint Bowman			INTERNET:	clint at ecy.wa.gov
Air Quality Modeler		INTERNET:	clint at math.utah.edu
Department of Ecology		VOICE:		(360) 407-6815
PO Box 47600			FAX:		(360) 407-7534
Olympia, WA 98504-7600

         USPS:           PO Box 47600, Olympia, WA 98504-7600
         Parcels:        300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 30 Oct 2013, Adams, Jean wrote:

> You should cc r-help on all correspondence so everyone can follow the
> thread.
>
> Clearly I'm missing something.  Perhaps others are, too.  I don't  know
> what you mean by "a score based on the co-localization of names" unless you
> give an example.
>
> Jean
>
>
> On Wed, Oct 30, 2013 at 10:34 AM, Stevan Lauriault <
> stevan.lauriault at gmail.com> wrote:
>
>> It would depend on the algorithm.  Which is why I'm writing.  I'm asking
>> if anyone knows of a preexisting algorithm that would calculate a score
>> based on the co-localization of names.
>>
>> S
>>
>>
>>
>>
>>
>> On Wed, Oct 30, 2013 at 10:56 AM, Adams, Jean <jvadams at usgs.gov> wrote:
>>
>>> What would the calculated score be for the example you give?
>>>
>>> Jean
>>>
>>>
>>> On Wed, Oct 30, 2013 at 7:03 AM, Stevan Lauriault <
>>> stevan.lauriault at gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm looking for a function that takes a list and calculates a score
>>>> based on
>>>> how well "like attracts like".
>>>> For example:
>>>>
>>>> list1 <- c(john, eric, steve, john, eric, scott, john)
>>>> list2 <- c(john, john, john, eric, eric, steve, scott)
>>>>
>>>> score(list1) < score(list2)
>>>>
>>>> Both lists are composed of the same names and frequency of each
>>>> name.
>>>>
>>>> Not sure how else to put it.  I am relatively new to R.  Have tried the
>>>> modularity function, but can't seem to get it to work for this purpose.
>>>>
>>>>
>>>> Any help is appreciated.
>>>>
>>>> Steve
>>>>
>>>>         [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>
>>>
>>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list