[R] R-help mailing list activity

2016-01-23 Thread Jean-Luc Dupouey

Dear members,

Not a technical question:

The number of threads in this mailing list, following a long period of 
increase, has been regularly and strongly decreasing since 2010, passing 
from more than 40K threads to less than 11K threads last year. The trend 
is similar for most of the "ancient" mailing lists of the R-project. I 
cannot imagine the total number of R-related inquiries on the Internet 
decreased. It means that contributors have gone elsewhere. Indeed, in 
the meantime, the number of R posts on stackoverflow passed from 2K to 
100K between 2009 and 2015. Thus my question: what are the 
specificities, the plus and minus of the R-project mailing lists, in 
comparison with other lists, and especially in comparison with 
stackoverflow? A lot of threads are duplicated on both lists, which 
seems to me a little bit counterproductive.


I hope it is the wright place to ask this question. Thanks in advance,

Jean-Luc Dupouey

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] .SavedPlots and replayPlot

2015-03-04 Thread Jean-Luc Dupouey
I would like to redraw a plot from the .SavedPlots object (list), using 
R code (not arrows on the keyboard).


 windows(record=TRUE)

 x=runif(100)
 plot(x,col=blue)
 hist(x,col=red)
 plot(x,col=green)

 #When I try to replay any of the recorded plots (here, the second 
one), I get the following error message:


 .SavedPlots[2]
Error in replayPlot(x) : loading snapshot from a different session

But I am in the same session! A quick look at function replayPlot shows 
that it is because the plots recorded in .SavedPlot do not have any pid 
value, whereas they should have one, equal to the current session pid.


Thus, assignation of the current session pid to the pid attribute of the 
recorded plots works:


 for (i in 1:.SavedPlots[[2]]) 
attr(.SavedPlots[[5]][[i]],pid)=Sys.getpid()

 #correctly gives the second plot:
 .SavedPlots[2]

Is it the right way to replay a plot in an R script, using .SavedPlots? 
Is there a simpler or better way?


I would prefer not to use recordPlot, which works, but requires an 
additional line of code and a new variable for each created plot:


 plot(x,col=blue)
 plot1=recordPlot()

 hist(x,col=red)
 plot2=recordPlot()

 plot(x,col=green)
 plot3=recordPlot()

 replayPlot(plot2)

I use R version 3.1.2.

Thanks in advance,

Jean-Luc Dupouey

--
INRA
Forest Ecology and Ecophysiology Unit
F-54280 Champenoux
France

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] smooth.spline gives different results from sreg ?

2013-07-27 Thread Jean-Luc Dupouey
Dear R-helpers,

I compared various programs for cubic spline smoothing, and it appeared 
that smooth.spline ( stats version 3.0.1) seems to behave surprisingly. 
For enough long series and low values of lambda (or spar), the results 
of smooth.spline seem to be different from those of sreg ( package 
fields version 6.8), Octave (=MATLAB) or SAS. These three last softwares 
always gave the same results.

Here is a script which shows the problem:

#generate a random series of 2000 values

set.seed(1)
MyData=data.frame(Time=1:2000,Val=runif(1000))

#calculate the sreg cubic smoothing spline with a given lambda parameter 
(0.006 here)

library(fields)

SplineFields=sreg(MyData$Time,MyData$Val,lambda=0.006)

#keep the minimim fitted value (or any other from a long list of 
possible values)

ValMin=min(SplineFields$fitted.values)
TimeValMin=which.min(SplineFields$fitted.values)

#calculations of all possible fitted values at the TimeValMin point with 
smooth.spline,
#varying the spar parameter in the range of all its possible values

SplineRValMin=sapply(seq(-0.5,2.5,0.1),
   function(Ispar) {
 SplineR=smooth.spline(MyData$Time,MyData$Val,spar=Ispar)
 SplineR$y[TimeValMin]})

#None of the smooth.spline fitted values reach the one calculated with 
sreg !

Lim=range(ValMin,SplineRValMin)

#smooth.spline values
plot(seq(-0.5,2.5,0.1),SplineRValMin,type=l,ylim=Lim)

#sreg value
abline(h=ValMin)

I hope there is no real problem here, but only some misunderstanding 
from my side, because cubic splines are very often used. Best regards,

Jean-Luc Dupouey

-- 
INRA-Nancy University
Forest Ecology and Ecophysiology Unit
F-54280 Champenoux
mail:dupo...@nancy.inra.fr


[[alternative HTML version deleted]]

__
R-help@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.


[R] precision warning in delaunayn function

2012-07-26 Thread Jean-Luc Dupouey

Dear R helpers,

I try to use the 'delaunayn' function in the 'geometry' package for 
Delaunay triangulation in 2 dimensions.


For the four following points, I get a warning message :

 coord=matrix(ncol=2,byrow=TRUE,c(622633,7073452,
+  621228,7073517,
+  621879,7071762,
+  621065,7073331))
 library(geometry)

 test=delaunayn(coord,options=Qbb)

qhull precision warning:

The initial hull is narrow (cosine of min. angle is 0.).
Is the input lower dimensional (e.g., on a plane in 3-d)?  Qhull may
produce a wide facet.  Options 'QbB' (scale to unit box) or 'Qbb' (scale
last coordinate) may remove this warning.  Use 'Pp' to skip this 
warning. See 'Limitations' in qh-impre.htm.


I read carefully qh-impre.htm and I still do not understand why I get 
this message.  A simple call to plot(coord) shows that the points are 
not aligned, nor very close.


What did I miss?

Thanking you in advance,

Jean-Luc Dupouey
INRA-Lorrain University
Forest Ecology  Ecophysiology Unit
F-54280 Champenoux
France
mail: dupo...@nancy.inra.fr

__
R-help@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.