[R-sig-Geo] averaging X of specific Y (latitude)

Hodgess, Erin HodgessE at uhd.edu
Sun Dec 16 06:24:01 CET 2012


Would this help you:

> butterfly
   V1      V2    V3
1  A1  130.50  9.45
2  A2  450.68 10.20
3  A3 1102.38  9.30
4  A4  893.34 16.40
5  B1  820.20 10.54
6  B2  872.20 10.87
7  B3  488.20 16.79
8  B4  620.11 18.30
9  B5  982.78 12.98
10 C1  720.32 12.67
11 C2  912.20 18.07
> table(cut(butterfly$V3,breaks=9:19))

 (9,10] (10,11] (11,12] (12,13] (13,14] (14,15] (15,16] (16,17] (17,18] (18,19] 
      2       3       0       2       0       0       0       2       0       2 
> 


________________________________________
From: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org] on behalf of Hodgess, Erin
Sent: Saturday, December 15, 2012 11:11 PM
To: Elaine Kuo; r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] averaging X of specific Y (latitude)

Could you put up a little sample from your data frame?  It's easier to work with then.

Erin


________________________________
From: Elaine Kuo [elaine.kuo.tw at gmail.com]
Sent: Saturday, December 15, 2012 10:26 PM
To: Hodgess, Erin
Cc: r-help at r-project.org; r-sig-geo
Subject: Re: [R-sig-Geo] averaging X of specific Y (latitude)

Hello,

Yes, it is a data frame.

This is the first time to hear "table" function or "cut" function.
Please kindly point out how to use them.

By the way,
if the dataset (data frame) includes more than 2000 kinds of butterfly range sizes and the latitude of range midpoints,
please kindly help with any suggestion to perform the task.
Thank you

Elaine

On Sun, Dec 16, 2012 at 12:20 PM, Hodgess, Erin <HodgessE at uhd.edu<mailto:HodgessE at uhd.edu>> wrote:
Hi!

Is it a data frame, please?

Have you tried the "table" function or "cut" function?

Sincerely,
Erin

________________________________________
From: r-sig-geo-bounces at r-project.org<mailto:r-sig-geo-bounces at r-project.org> [r-sig-geo-bounces at r-project.org<mailto:r-sig-geo-bounces at r-project.org>] on behalf of Elaine Kuo [elaine.kuo.tw at gmail.com<mailto:elaine.kuo.tw at gmail.com>]
Sent: Saturday, December 15, 2012 10:15 PM
To: r-help at r-project.org<mailto:r-help at r-project.org>; r-sig-geo
Subject: [R-sig-Geo] averaging X of specific Y (latitude)

Hello



I have a table describing butterfly range traits.

It is composed of three columns as below



Species name  range size (X)    latitude of range midpoint (Y)



There are 11 kinds of butterflies.

Each has its range size, and the latitude of each range midpoint ranges
from 9 to 19.

I would like to have the average range size of every degree of latitude.

For example, the average range size of latitude degree 10 (10.0-10.99:
Butterfly A2, B1, B2)

Please kindly help with R code to calculate the average values.

Thank you.


Elaine


The details are as followed.



Butterfly A1      130.5                 9.45

Butterfly A2      450.68                           10.2

Butterfly A3      1102.38                        9.3

Butterfly A4            893.34                             16.4

Butterfly B1           820.2                               10.54

Butterfly B2            872.2                               10.87

Butterfly B3            488.2                               16.79

Butterfly B4            620.11                             18.3

Butterfly B5            982.78                             12.98

Butterfly C1           720.32                             12.67

Butterfly C2            912.2                               18.07

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org<mailto:R-sig-Geo at r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list