I have a large dataset with columns Id, Vg, Device, Die, W, L and others (not relevant to this question). I want Vg interpolation for a given Id value, but this operation should be performed on the data grouped by the Device and Die column.
My sample data looks like
Die Device Id Vg W L
1 Device1 1 0 10 1
1 Device1 1.2 0.1 10 1
1 Device1 1.3 0.2 10 1
1 Device2 1 0 10 2
1 Device2 1.2 0.1 10 2
1 Device2 1.3 0.2 10 2
1 Device3 1 0 10 3
1 Device3 1.2 0.1 10 3
1 Device3 1.3 0.2 10 3
Each stamp has 22 unique devices. There are 67 stamps and 22 device names on each matrix are the same. Therefore, if I interpolate Vg for Id = 1.25, I expect to get 22 * 67 Vg values for Id = 1.25.
Here is the code I'm trying
data_tidy%>%
group_by(Die,Device)%>%
mutate(Vt=approx(x=log10(Id),y=Vg,xout=log10(3e-8*W/L))$y)
This is similar to what is suggested here , and I copy the suggested code from the link below
df %>%
group_by(variable) %>%
arrange(variable, event.date) %>%
mutate(time=seq(1,n())) %>%
mutate(ip.value=approx(time,value,time)$y) %>%
select(-time)
However, when I execute my code above, an error message appears
: 18