Ejemplo n.º 1
0
func (this *NumericVector) ToArray() []float64 {
	C.Rf_protect(this.expr)
	defer C.Rf_unprotect(1)
	array := make([]float64, this.length)
	for i := 0; i < this.length; i++ {
		array[i] = float64(C.NumericVectorElt(this.expr, C.int(i)))
	}
	return array
}
Ejemplo n.º 2
0
func (this *NumericVector) Get(i int) float64 {
	this.boundsCheck(i)
	C.Rf_protect(this.expr)
	defer C.Rf_unprotect(1)
	return float64(C.NumericVectorElt(this.expr, C.int(i)))
}