예제 #1
0
파일: numeric.go 프로젝트: Gwill/go-R
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
}
예제 #2
0
파일: numeric.go 프로젝트: Gwill/go-R
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)))
}