projectDataInto1d | R Documentation |
Project multidimensional dataset onto a line described by two points (centers).
projectDataInto1d(x,
c0, c1)
x |
multidimensional data ( |
c0 |
first center (vector in |
c1 |
second center (vector in |
A vector of length n
holding the projection of data onto
the line aligned along centers c0
and c1
.
Points in the hyperplane perpendicular to the line and
intersecting center c0
get mapped to 0
, points in
the hyperplane perpendicular to the line and intersecting center
c1
get mapped to 1
, etc.
Tomas Sieger
set.seed(1)
x1<-cbind(rnorm(100,-2),rnorm(100))
x2<-cbind(rnorm(100,2),rnorm(100))
p<-projectDataInto1d(rbind(x1,x2),c0=c(-2,0),c1=c(2,0))
layout(rbind(1,2))
plot(rbind(x1,x2),frame=FALSE,main='2D data')
hist(p,breaks=50,main='1D projection')
layout(1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.