[R] Creating a point pattern with cartesian co-ordinates

Rolf Turner rolf.turner at xtra.co.nz
Fri May 4 01:57:03 CEST 2012


(1) There's something funny about the data that you present below.
At least in my mailer (Thunderbird) what looks like a space between
the X and Y values turns into a NULL character when I try to copy
and paste.

(2) Create a data frame, say "M" with the X and Y values as given
in your email.

(3) Install and load the spatstat package.

(4) Do:

     W <- with(M, ripras(x=X,y=Y,shape="rectangle")
     PAT <- with(M,ppp(x=X,y=Y,window=W)
     plot(PAT)

     cheers,

             Rolf Turner

On 04/05/12 03:42, AMFTom wrote:
> I have the following data from an image analysis program, in which the x and
> y co-ordinates are locations of the centroids of shapes on a 2 dimensional
> plot. The Y co-ordinates were positive, but I changed them to negative as
> the resulting scatterplot was upside down (the image analysis program reads
> from the top of the image to the bottom, so it seems) I now need these as
> point pattern data, as I want to subsequently add marks to them (area of
> shape):
>
> Can anybody assist?
>
> X                    Y
> 159.163	-165.203
> 162.469	-233
> 167.77	-213.503
> 169.988	-174.764
> 172.113	-246.258
> 172.494	-232.865
> 177.855	-213.164
> 178.568	-250.038
> 179.486	-186.033
> 180.208	-244.185
> 184.28	-170.754
> 185.447	-181.114
> 185.597	-193.815
> 188.779	-204.507
> 192.978	-220.553
> 198.208	-224.535
> 199.346	-185.853
> 200.3	-229.917
> 204.028	-190.552
> 205.1	-217.909
> 208.686	-242.057
> 212.575	-243.511
> 212.942	-223.68
> 212.994	-259.469
> 215.643	-200.613
> 217.51	-219.069
> 218.193	-225.037
> 220.049	-172.226
> 220.181	-251.714
> 221.946	-185.973
> 222.738	-195.468
> 223.08	-177.071
> 225.058	-262.459
> 225.265	-220.209
> 228.767	-199.047
> 229.196	-188.481
> 230.268	-245.925
> 233.604	-207.356
> 234.708	-247.057
> 234.874	-213.096
> 239.822	-251.908
> 240.771	-178.647
> 242.287	-193.157
> 242.468	-249.385
> 243.207	-233.702
> 247.955	-196.673
> 248.178	-252.502
> 250.82	-147.687
> 252.076	-209.894
> 253.883	-199.777
> 255.635	-251.216
> 257.03	-78.085
> 257.108	-229.982
> 258.46	-119.812
> 258.641	-218.726
> 258.953	-166.529
> 259.216	-150.816
> 260.544	-146.563
> 260.557	-84.336
> 260.59	-67.364
> 260.742	-190.558
> 262.247	-79.629
> 262.316	-86.505
> 262.436	-227.381
> 263.622	-127.775
> 263.814	-85.251
> 263.874	-94.635
> 264.945	-75.656
> 265.038	-223.406
> 265.313	-204.995
> 269.082	-183.29
> 269.428	-209.686
> 269.984	-246.628
> 270.371	-84.1
> 271.263	-72.811
> 271.886	-195.877
> 272.59	-250.311
> 273.572	-97.019
> 274.086	-199.21
> 274.329	-235.096
> 276.979	-77.21
> 277.313	-246.859
> 278.096	-188.909
> 278.223	-68.026
> 278.35	-139.616
> 280.89	-195.992
> 281.413	-78.605
> 282.904	-92.113
> 284.499	-231.532
> 285.708	-240.821
> 286.862	-221.241
> 287.679	-135.925
> 290.702	-68.571
> 290.744	-76.063
> 291.361	-239.134
> 292.471	-89.893
> 292.915	-229.442
> 293.193	-99.059
> 294.381	-81.307
> 295.605	-141.156
> 298.543	-100.885
> 298.689	-239.704
> 299.711	-137.435
> 299.925	-221.066
> 300.618	-130.093
> 302.588	-93.782
> 304.273	-203.95
> 304.766	-194.382
> 305.091	-110.146
> 306.04	-88.153
> 306.761	-186.272
> 307.554	-173.64
> 307.778	-80.67
> 310.273	-87.523
> 310.368	-103.525
> 310.621	-71.728
> 311.168	-193.219
> 311.29	-198.237
> 311.338	-168.259
> 311.925	-115.413
> 312.178	-203.015
> 312.577	-98.959
> 314.495	-81.542
> 315.035	-185.075
> 315.256	-92.839
> 316.889	-196.098
> 317.982	-95.894
> 318.453	-181.028
> 320.048	-67.681
> 320.888	-88.357
> 321.327	-75.035
> 322.997	-104.616
> 323.373	-95.794
> 324.414	-193.768
> 325.789	-84.277
> 327.046	-89.805
> 328.459	-78.971
> 329.2	-251.549
> 329.913	-72.674
> 332.794	-263.695
> 333.451	-200.654
> 333.756	-124.516
> 334.524	-174.331
> 335.301	-213.95
> 335.759	-166.324
> 335.848	-210.629
> 336.07	-75.13
> 337.105	-87.3
> 337.78	-178.097
> 338.997	-65.673
> 340.501	-184.499
> 341.346	-193.458
> 341.55	-230.801
> 342.054	-80.684
> 343.082	-202.06
> 344.873	-69.301
> 345.798	-232.187
> 347.177	-201.136
> 347.53	-103.792
> 348.168	-87.125
> 349.156	-236.411
> 349.531	-252.794
> 350.503	-92.074
> 350.79	-116.177
> 350.953	-177.364
> 354.308	-123.398
> 354.417	-237.45
> 355.424	-197.235
> 358.092	-164.202
> 361.405	-240.484
> 363.009	-213.804
> 364.806	-243.099
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Creating-a-point-pattern-with-cartesian-co-ordinates-tp4606343.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.
>



More information about the R-help mailing list