Description Usage Arguments Value References Examples

Convertes a pice-wise linear parametrized funtion into a discretized voxel representation.

1 |

`f` |
A parametrized function as a list containing a vector "args" (arguments), and a matrix "vals" (values, d columns). |

`from` |
A vector of d numbers, each giving a starting discretization point for one dimension. |

`to` |
A vector of d numbers, each giving a finishing discretization point for one dimension. |

`by` |
A vector of d numbers, each giving discretization step for one dimension. |

A list containing two matrices: "voxels" with rows being voxel numbers, and "coords" with rows being coordinates of voxel centers.

Lafaye De Micheaux, P., Mozharovskyi, P. and Vimond, M. (2018). Depth for curve data and applications.

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 31 32 33 | ```
library(curveDepth)
# Create some data based on growth curves
g1d <- dataf.growth()
g3d <- list("")
set.seed(1)
for (i in 1:length(g1d$dataf)){
g3d[[i]] <- list(
args = g1d$dataf[[1]]$args,
vals = cbind(g1d$dataf[[i]]$vals,
g1d$dataf[[i]]$vals[length(g1d$dataf[[i]]$vals):1],
rnorm(length(g1d$dataf[[i]]$vals), sd = 1) +
rnorm(1, mean = 0, sd = 10)))
}
# Define voxels' bounds and resolution
from <- c(65, 65, -25)
to <- c(196, 196, 25)
steps <- 100
by <- (to - from) / steps
# Voxelize all curves
fs <- list("")
for (i in 1:length(g3d)){
fs[[i]] <- voxelize(g3d[[i]], from, to, by)
}
## Not run:
# Plot first 10 curves
library(rgl)
rgl.open()
rgl.bg(color = "white")
for (i in 1:10){
spheres3d(fs[[i]]$voxels[, 1], fs[[i]]$voxels[, 2], fs[[i]]$voxels[, 3],
col = "red", radius = 0.5)
}
## End(Not run)
``` |

```
Loading required package: Rcpp
Loading required package: ddalpha
Loading required package: MASS
Loading required package: class
Loading required package: robustbase
Loading required package: sfsmisc
Loading required package: geometry
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl.init' failed, running with 'rgl.useNULL = TRUE'.
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.