[R] FW: averaging two tables (rows with columns)

Sarah Goslee sarah.goslee at gmail.com
Thu May 10 19:24:45 CEST 2012


Kristi,

Several people have already suggested you use dput() to provide your data.

In R,
dput(table1)
dput(table2)

Then copy and paste the output of those commands into your email.

There's no way to reliably copy and paste your raw data: using dput()
is the best way to provide it.

Sarah

On Thu, May 10, 2012 at 1:18 PM, Kristi Glover
<kristi.glover at hotmail.com> wrote:
>
> Hi R-usuar,
> I still find the table is not in readable formate. I now forwarded the email.hope it works. I sent it to my account . It was perfect- but when I sent it to R help- then it comes with unreadable formate. This is my last try. If not, then I will try to do in Excel manually. cheers,
>
> From: kristi.glover at hotmail.com
> To: kristi.glover at hotmail.com
> Subject: RE: [R] averaging two tables (rows with columns)
> Date: Thu, 10 May 2012 14:06:41 -0300
>
>
>
>
>
> Hi John , Petr and R userI am sorry that my data was not readable formate in the last email. Agin I am trying to send it. hope this time, that  table can be readable.
> As I mentioned earlier that I was struggling to figure out on how I can calculate the average from the two tables in R. Any one can help me? really your helpwould be grateful- I am spending so much time to figure it out. It should not be so hard, I think.I have very big data but I have created a hypothetical data for simplification.for example
> I have : table 1
> Table 1: species occurrence data> table1      X speciesX speciesY speciesZ speciesXX1 Plot1        1        0        1         02 Plot2        0        1        1         03 plot3        1        0        0         14 plot4        0        0        1         0
>
> Table 2: table 2. species tolerance data
>>table2                  X EnviA EnviB EnviC1  SpeciesX  0.21  0.40  0.172  SpeciesY  0.10  0.15  0.183 SpeciesXY  0.14  0.16  0.19
>
> You may noticed that table 2 does not have species Z which was in table
>
> Table 3: Now I want to get the average value of species tolerance in each plot based on each environmental value (EnviA or EnviB etc).The example of the out come (final table I was looking for it).
> Results table 1a: averages species tolerance in each plot based on EnviA
> such as:
>> table3.a      X speciesX speciesY speciesZ speciesXX average1 plot1     0.21       NA   Nodata      0.14   0.1752 plot2       NA      0.1   Nodata        NA   0.1003 plot3       NA       NA   Nodata      0.14   0.1404 plot4     0.21       NA   Nodata        NA   0.210Table 4
>
>> table3.b: Result table 1b: average species tolerance in plot based on EnviB      X speciesX speciesY speciesZ speciesXX average1 plot1      0.4       NA   Nodata      0.16    0.282 plot2       NA     0.15   Nodata        NA    0.153 plot3       NA       NA   Nodata      0.16    0.164 plot4      0.4       NA   Nodata        NA    0.40
> I hope this time the data would be readable formate. Would any one help me how I can calculate these?Thanks
> Kristi Golver==
>
>
>
>> Date: Thu, 10 May 2012 08:01:11 -0800
>> From: jrkrideau at inbox.com
>> Subject: RE: [R] averaging two tables (rows with columns)
>> To: kristi.glover at hotmail.com; r-help at r-project.org
>>
>> Kristi,
>> Your data has come through in a totally unreadable layout.
>>
>> Have a look at ?dput as a handy way to present sample data.  Just run dput(mydata), copy the output and paste into the email.
>>
>> John Kane
>> Kingston ON Canada
>>



More information about the R-help mailing list