Closed szcf-weiya closed 4 years ago
Hello szcf-weiya! This was indeed not intentional. I fixed it in the commit above :+1: Thanks a lot!
I won't be able to publish the changes on CRAN until Aug 24th:
Error: Submission failed: The submission team is on vacation from Aug 14, 2020 to Aug 24, 2020. During this time the submission of packages is not possible. Sorry for any inconvenience.
Thanks again, @szcf-weiya! princurve 2.1.5 is on its way to CRAN.
After fitting the principal curve,
the
s
would look likethen I want to get the location for new data point
[0, 1]
viabut then I found
s
changedI checked your program, it should be due to https://github.com/rcannood/princurve/blob/1dd2979c5d8f675a11fde9efbe001294f6772841/src/project_to_curve.cpp#L59-L60 and I also try to find if this is a feature (or say requirement) for your other code, such as https://github.com/rcannood/princurve/blob/1dd2979c5d8f675a11fde9efbe001294f6772841/R/principal_curve.R#L195 but it seems that you do not access the previous
s
.I am wondering if it is necessary to avoid such a phenomenon if you do not rely on it. At first, I am quite confused. Based on my experience, R cannot modify the elements of a vector/matrix after reassignment, I mean, for the following toy example,
a
is stillc(0, 1)
, so it does not needcopy
function like in other programming languages, and hence it does not have such functions (right?). For the changeds
, I guess it is due to Rcpp, and indeed I found an explanation http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2014-February/007081.html, so if possible,Rcpp::clone(s)
can avoid this issue.Can we change it? Or am I missing something?