How can I do to represent vectors of variable x1,x2?
you've achieved your goal.
data object that you made with matrix() gives you
x2 vectors arranged in a columnar fashion
transport_data object that you made by transposing
data is a rowwise matrix that represents
I have to create variable's span
I commit an error I need observations span
Its very unclear what you mean.
what are the 'observations' in this context ?
and aren't "spans" in linear algebra all the possible linear combinations of the vectors ? Mustn't the answer therefore be somewhat algebraic, because if you tried to enumate them, it would be infinite... ?
Hi, and welcome!
Here's a bit more compact way to do this, and if you want to unpack one of the four vectors, you would call them with
x1 <- c(4,-1,3) x2 <- c(1,3,5) m <- t(cbind(x1,x2)) m #> [,1] [,2] [,3] #> x1 4 -1 3 #> x2 1 3 5 m[1,] #>  4 -1 3 m[2,] #>  1 3 5 m[,1] #> x1 x2 #> 4 1 m[,2] #> x1 x2 #> -1 3
Created on 2020-02-22 by the reprex package (v0.3.0)
I would obtain a triplot whit 2 points that represent my variables x1 and x2 and arrows that link point (0,0,0) with x1 and (0,0,0) with x2
Are you trying to create a
graph object? (Sometimes referred to as a network representation.)
I think @Daniel96 means he's trying to create a 3D plot with two (geometric) vectors, one from the origin to the point x1, and one from the origin to the point x2. I can help with a 2D version, but I have no idea how to help with a 3D version, however.
I tried with scatterplot3d()
But I don't have any idea how can I represent vectors in R3
x1 <- c(4,-1,3) x2 <- c(1,3,5) origin <- c( 0, 0, 0) m <- t(cbind(x1,x2,origin)) library("scatterplot3d") # load scatterplot3d(m, type="p", color = c("red","blue","black"), pch = 1, xlim = c(-6,6), ylim = c(-6,6), zlim = c(-6,6))
I'm afraid I don't know what a triplot is but this is a scatterplot3d
Here's a post on Stack Overflow about drawing 3D vectors with a package called
rgl -- maybe try that?
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.