[R-sig-Geo] How to subset my data

Idowu, Oluseun S. (UMKC-Student) oluseun.idowu at mail.umkc.edu
Mon Jul 16 02:39:38 CEST 2012


Hello:
I have a .txt file i'm reading in R with 3670016 nrows made up of (256
lat, 512 lon and 28 forecast time) and ncol=31(no of days in the month). I
read the lat/lon data and got that my area of interest is at point row=93
to row 128 for lat and row 30 to 1 & 257 to 286 for lon. My issue is how
do I correctly select my data subset from the 36700016 rows. I see that
most of the data a repeated to make up the nrows but what command can I
use to make a right selection. Thanks in advance for your help.

See data below 
head(dataTEMP)
        V1       V2       V3       V4       V5       V6       V7       V8
1 273.8134 273.8701 274.3947 274.0019 273.9000 273.6819 274.3362 273.6229
2 273.8134 273.8721 274.3947 273.9980 273.8961 273.6838 274.3362 273.6248
3 273.8134 273.8760 274.3947 273.9921 273.8942 273.6858 274.3343 273.6248
4 273.8114 273.8779 274.3947 273.9882 273.8903 273.6877 274.3323 273.6268
5 273.8114 273.8818 274.3947 273.9824 273.8864 273.6897 274.3323 273.6287
6 273.8114 273.8838 274.3947 273.9785 273.8824 273.6917 274.3304 273.6307
        V9      V10      V11      V12      V13      V14      V15      V16
1 274.2525 274.0379 274.6470 274.4238 273.5143 274.1406 274.3043 274.9282
2 274.2525 274.0379 274.6470 274.4218 273.5163 274.1426 274.3043 274.9301
3 274.2525 274.0379 274.6450 274.4218 273.5182 274.1426 274.3024 274.9321
4 274.2525 274.0379 274.6450 274.4218 273.5221 274.1426 274.3024 274.9321
5 274.2525 274.0379 274.6431 274.4199 273.5241 274.1445 274.3004 274.9340
6 274.2505 274.0379 274.6431 274.4199 273.5260 274.1445 274.3004 274.9360
       V17      V18      V19      V20      V21      V22      V23      V24
1 275.0095 274.4799 275.1027 274.9044 274.8814 275.0872 274.9467 275.0533
2 275.0095 274.4799 275.1046 274.9064 274.8794 275.0852 274.9467 275.0553
3 275.0095 274.4799 275.1046 274.9064 274.8775 275.0833 274.9486 275.0553
4 275.0076 274.4819 275.1046 274.9083 274.8755 275.0813 274.9506 275.0573
5 275.0076 274.4819 275.1066 274.9103 274.8736 275.0793 274.9506 275.0592
6 275.0076 274.4838 275.1066 274.9103 274.8697 275.0754 274.9525 275.0612
       V25      V26      V27      V28      V29      V30      V31
1 274.9663 274.6910 274.6379 274.8774 274.7449 274.7726 274.4701
2 274.9702 274.6929 274.6399 274.8754 274.7585 274.7726 274.4701
3 274.9742 274.6929 274.6418 274.8754 274.7703 274.7745 274.4681
4 274.9781 274.6949 274.6438 274.8735 274.7839 274.7745 274.4662
5 274.9800 274.6968 274.6458 274.8735 274.7957 274.7745 274.4662
6 274.9839 274.6988 274.6477 274.8715 274.8093 274.7765 274.4642

tail(dataTEMP)
              V1       V2       V3      V4       V5       V6       V7
 V8
3670011 218.8708 219.7255 219.2522 218.198 221.2890 213.5748 217.6296
226.0363
3670012 218.8786 219.7274 219.2463 218.198 221.2831 213.5807 217.6198
226.0090
3670013 218.8864 219.7294 219.2424 218.198 221.2773 213.5865 217.6100
225.9816
3670014 218.8942 219.7333 219.2385 218.198 221.2714 213.5924 217.5983
225.9543
3670015 218.9020 219.7352 219.2346 218.196 221.2636 213.5982 217.5885
225.9270
3670016 218.9118 219.7391 219.2287 218.196 221.2577 213.6060 217.5768
225.8996
              V9      V10      V11      V12      V13      V14      V15
 V16
3670011 225.0423 216.0866 211.2848 214.1108 214.3512 221.4184 236.3481
217.9475
3670012 225.0306 216.0866 211.2750 214.1010 214.3532 221.4263 236.3364
217.9514
3670013 225.0189 216.0866 211.2653 214.0932 214.3551 221.4360 236.3266
217.9553
3670014 225.0071 216.0866 211.2555 214.0834 214.3571 221.4458 236.3169
217.9592
3670015 224.9954 216.0866 211.2457 214.0756 214.3591 221.4556 236.3051
217.9631
3670016 224.9837 216.0885 211.2360 214.0658 214.3610 221.4634 236.2954
217.9670
             V17      V18      V19      V20      V21      V22      V23
 V24
3670011 222.9712 223.2803 223.1307 218.4524 229.5565 221.0723 226.7856
227.7539
3670012 222.9673 223.2940 223.1365 218.4544 229.5682 221.0801 226.7934
227.7481
3670013 222.9634 223.3057 223.1443 218.4563 229.5818 221.0879 226.8012
227.7422
3670014 222.9615 223.3194 223.1502 218.4583 229.5936 221.0957 226.8071
227.7363
3670015 222.9576 223.3311 223.1561 218.4622 229.6053 221.1055 226.8149
227.7305
3670016 222.9536 223.3428 223.1619 218.4641 229.6190 221.1133 226.8227
227.7227
             V25      V26      V27      V28      V29      V30      V31
3670011 227.5125 230.8432 221.8371 211.2838 216.2357 223.5838 221.5377
3670012 227.5105 230.8491 221.8429 211.2760 216.2376 223.5858 221.5416
3670013 227.5105 230.8549 221.8488 211.2682 216.2396 223.5877 221.5435
3670014 227.5086 230.8608 221.8547 211.2604 216.2435 223.5897 221.5474
3670015 227.5066 230.8667 221.8625 211.2526 216.2454 223.5916 221.5513
3670016 227.5047 230.8725 221.8683 211.2448 216.2493 223.5936 221.5552



Sam 




On 7/15/12 7:12 PM, "seth at swbigelow.net" <seth at swbigelow.net> wrote:

>
>
>	r-sig-geo listers:
>
>	Can anyone provide code or suggest commands for converting a data
>frame with UTMS to a SpatialPolygons (sp package) object? Below, I
>provide code to generate a sample dataframe, with three ordered
>sequences of twelve coordinate pairs each.
>
>	id
>
>	[[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