[R] Beginner Question: List value without Levels

Joshua Wiley jwiley.psych at gmail.com
Tue May 24 21:22:16 CEST 2011


Hi Dabs,

If those are your two objects, could you post the output from:

dput(myVal)
dput(data)

The output of dput() can be copied and pasted into the console and
then we have the data on our systems exactly as you do on yours.  From
there it should be easy to show you how to do what you want.

Cheers!

Josh

On Tue, May 24, 2011 at 11:54 AM, dabs <ragon016 at web.de> wrote:
> Hey folks,
>
> I'm new to the R Project so I'm facing a great problem. I've read a file
> into R:
>
>
>>myVal
>    I   V   L   F   C   M   A    G    T    W    S    Y    P    H    Q    D
> N    E    K    R
> 1 4,5 4,2 3,8 2,8 2,5 1,9 1,8 -0,4 -0,7 -0,9 -0,8 -1,3 -1,6 -3,2 -3,5 -3,5
> -3,5 -3,5 -3,9 -4,5
>> mode(myVal)
>   [1] list
>
>
> Now I want to multiplicate each of this values with this one:
>
>>data
>  A  C  D  E  F  G  H  I  K  L  M  N  P  Q  R  S  T  V  W  Y
> 28  8 11 14 17 34  7 26 15 26 10  9 12  8 11 21 19 33  7  7
>> mode(data)
> [1] "numeric"
>
>
> Because I don't know how to do that. I had in mind to write a function, in
> which every single value is multiplicated with the other one. So I tried to
> test, if I could multiplicate two single values. This is the result:
>
>> myVal[1,1] * data[1]
> [1] NA
> Warning:
> In Ops.factor(myVal[1, 1], data[1]) :
>  * nicht sinnvoll für Faktoren
>
>
> (I'm using R with German language :))
>
> What can I do, to multplicate each value with his adequate?
>
> Thanks a lot :)!
>
> dabs
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Beginner-Question-List-value-without-Levels-tp3547911p3547911.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list