Hey, R-listers
I am a new user of R and just found the package of PCURVE which can estimate
principal curve for arbitrary
dimensional data set.
Now I have some 2-Dimensional data set X, which is stored as an Nx2 matrix in
data.txt file and looks as following:
-1.5551 2.4183
1.0051 1.0102
0.90644 0.82163
1.3248 1.7551
-1.3626 1.8568
-1.3554 1.8371
0.039396 0.0015521
-0.99622 0.99245
0.2314 0.053544
1.4127 1.9956
1.3814 1.9083
0.83861 0.70326
-1.045 1.092
-1.8073 3.2665
0.54591 0.29801
-0.69022 0.47641
-0.7084 0.50183
0.12357 0.015271
0.80539 0.64865
0.25549 0.065274
0.68935 0.47521
1.7864 3.1911
0.6431 0.41358
0.14709 0.021635
-0.5128 0.26296
0.49692 0.24693
1.3053 1.7039
-0.63626 0.40483
1.7643 3.1126
0.3945 0.15563
1.2391 1.5354
0.73498 0.5402
1.023 1.0465
0.16561 0.027426
-0.015812 0.00025002
1.6118 2.5978
-0.60822 0.36993
-0.45553 0.2075
1.7689 3.129
-1.5722 2.4718
0.24103 0.058093
1.1138 1.2406
-0.7679 0.58967
-0.19286 0.037195
0.025852 0.00066834
-1.2959 1.6793
1.3295 1.7675
-0.80465 0.64746
1.1729 1.3758
0.4756 0.2262
So how could I use the PCURVE to get the estimated principal curve? I tried, but
alwasy got some error message.
> x <- as.matrix(read.table("data.txt"));
> s <- pcurve(x, plot.init = FALSE, use.loc = TRUE);
"Empty row or column (or negative sum) in table
Error in xy.coords(x, y) : x and y lengths differ"
So would you please give me a point on how to use it in R correctly?
Thanks for your time and help.
Fred
[[alternate HTML version deleted]]