Defining curve points

It seems to me that this is a simple question ...

How do you determine the coordinates in the picture? I built some data, used unireg (uniReg package) to make a spline curve, and I want to get the data out of the point.

library(uniReg) P0mM <- read.table(text=" Time FeuM 0.04 138.8181818 7 1258.636364 14 1320.545455 21 2110.37037 28 13730.37037 35 1550.909091",header=TRUE) z=seq(min(P0mM$Time),max(P0mM$Time),length=201) uf=with(P0mM,unireg(Time,FeuM,g=5,sigma=1)) plot(FeuM~Time,P0mM,ylim=c(0,16000),ylab="Fe2+ uM", xlab="Time", main="0mM P") lines(z,uf$unimod.func(z)) 

enter image description here

I managed to find the maximum value of the curve (14444)

 max((uf$unimod.func(z))) 

I want to determine where on the x axis this happens. (It should be around 30, but I want to be precise).

How do you do this?

Thanks!

+7
max r spline
source share
1 answer

Similar to optimize or optimize (depending on your affinity for English or American English):

 optimise(uf$unimod.func, maximum=TRUE, interval=range(P0mM$Time)) #$maximum #[1] 29.27168 # #$objective # [,1] #[1,] 14444.85 
+6
source share

All Articles