I wrote the following code in R
library(fda)
n_curves <- 15951
n_points <- 2537
argvals <- matrix(df_l$Time, nrow = n_points, ncol = n_curves)
y_mat <- matrix(df_l$Curve, nrow = n_points, ncol = n_curves)
W.obj <- Data2fd(argvals = argvals, y = y_mat, basisobj = basis, lambda = 0.5)
But I'm getting an error
Error in if ((a01[1] <= arng[1]) && (arng[2] <= a01[2])) { :
missing value where TRUE/FALSE needed
What does it mean, and how do I prevent it?
I'm using a repeated measures data, and I`m trying to do functional data analysis.My data has a lot of missing values(NA). I'm thinking that NA is probably the cause of something.
data:
> dput(head(df_l, 30))
structure(list(Time = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30), Curve = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, 5, 10, 10, 10, 10, 8, 8, 8, 8,
8, 8)), row.names = c(NA, 30L), class = "data.frame")
> dput(head(basis, 5))
list(call = basisfd(type = type, rangeval = rangeval, nbasis = nbasis,
params = params, dropind = dropind, quadvals = quadvals,
values = values, basisvalues = basisvalues), type = "bspline",
rangeval = c(0, 2537), nbasis = 53, params = c(50.74, 101.48,
152.22, 202.96, 253.7, 304.44, 355.18, 405.92, 456.66, 507.4,
558.14, 608.88, 659.62, 710.36, 761.1, 811.84, 862.58, 913.32,
964.06, 1014.8, 1065.54, 1116.28, 1167.02, 1217.76, 1268.5,
1319.24, 1369.98, 1420.72, 1471.46, 1522.2, 1572.94, 1623.68,
1674.42, 1725.16, 1775.9, 1826.64, 1877.38, 1928.12, 1978.86,
2029.6, 2080.34, 2131.08, 2181.82, 2232.56, 2283.3, 2334.04,
2384.78, 2435.52, 2486.26))