[R] Vector with factors inside lists/tuples

David Winsemius dwinsemius at comcast.net
Sat Jun 25 23:40:39 CEST 2011


On Jun 25, 2011, at 4:01 PM, Håvard Wahl Kongsgård wrote:

>>> glm( V0 ~ "HARRY"  + "KLINE" + "Brown" + "Larry")
>>
>> No. You are mistaken. Assuming that V0 is defined and has the same  
>> length as
>> there are rows in that data.frame, then V1 and V2 would be the  
>> arguments in
>> the formula and they would not be quoted.
>>
>> ?glm   # and work through the examples
>
> With the example I meant that the factors in the vector V1 and V2
> would be treated like individual binary/dummy variables.

They would have been with the call I offered. I get the sense that the  
best advice might be to consult a local statistician.

>
> Back to my real question; Is there no other way to do this in R???

"Do this"? You have offered no workable example and only the vaguest  
of descriptions of the task.

-- 
David.
>
>
> 2011/6/25 David Winsemius <dwinsemius at comcast.net>:
>>
>> On Jun 25, 2011, at 2:13 PM, Håvard Wahl Kongsgård wrote:
>>
>>> Hi, sorry my question was not really clear
>>>
>>>  |Are you very early in efforts at learning R?
>>> No, have been a long term user of R, but only use R for the  
>>> statistical
>>> stuff.
>>>
>>> The heart of the issue is that I have list of keywords that I want  
>>> to
>>> analyse with a machine learning algorithm (20 000 keywords with a
>>> response variables). It's much like "micro" array data, but in my  
>>> case
>>> it's not "genes", but instead keywords. To get it to work in R, I
>>> could create a data frame with multiple vectors containing different
>>> factors.
>>> That would look like this
>>> V1, V2,
>>> "Harry", "Kline"
>>> "Brown", "Larry"
>>>
>>> If I am not mistaken if I used V1 and V2 with the standard GLM
>>> function the result would be like
>>>
>>> glm( V0 ~ "HARRY"  + "KLINE" + "Brown" + "Larry")
>>
>> No. You are mistaken. Assuming that V0 is defined and has the same  
>> length as
>> there are rows in that data.frame, then V1 and V2 would be the  
>> arguments in
>> the formula and they would not be quoted.
>>
>> ?glm   # and work through the examples
>>
>>>
>>> Or I could create a complex ordered array where keywords are
>>> represented 1 and 0.
>>> If I used that in GLM I would get the same result with glm?
>>>
>>> But is there a better approach?
>>>
>>> -Håvard
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>>
>
>
>
> -- 
> Håvard Wahl Kongsgård
>
> http://havard.security-review.net/

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list