[R] vector entry in matix

2012-07-05 Thread Thomas C.
hi, i'm trying to figure out if there's any possibility to write a whole vector into a matrix or data.frame or something like that. i don't mean transormation. Here an example: [,1] [,2] [1,] a d [2,] b e [3,] c f where e.g. a is a-c(0,1) vector of length 2, b a vector of length 4,...

Re: [R] vector entry in matix

2012-07-05 Thread R. Michael Weylandt
It is possible to put dimensionality on a list (i.e., a generic vector), which might be what you're looking for. x - list(1:4, letters[1:4], function(x,y) x + y, rnorm(50)) dim(x) - c(2,2) x[[1,2]] x[[2,2]] x[[3,2]] # Error Best, Michael On Thu, Jul 5, 2012 at 8:19 AM, Thomas C.

Re: [R] vector entry in matix

2012-07-05 Thread David Winsemius
On Jul 5, 2012, at 11:22 AM, R. Michael Weylandt wrote: It is possible to put dimensionality on a list (i.e., a generic vector), which might be what you're looking for. x - list(1:4, letters[1:4], function(x,y) x + y, rnorm(50)) dim(x) - c(2,2) x[[1,2]] x[[2,2]] x[[3,2]] # Error That

Re: [R] vector entry in matix

2012-07-05 Thread Thomas C.
well thank you, i think we get closer to my problem. but i meant it in a different way. maybe i describe what i intended to do: i have number of triangles which i'd like to store in a list, matrix,...etc. i thought it could look sth. like that: trianglenode1node2

Re: [R] vector entry in matix

2012-07-05 Thread arun
NA ... z2-as.matrix(z) A.K. - Original Message - From: Thomas C. thomas.csa...@gmail.com To: r-help@r-project.org Cc: Sent: Thursday, July 5, 2012 9:19 AM Subject: [R] vector entry in matix hi, i'm trying to figure out if there's any possibility to write a whole vector into a matrix

Re: [R] vector entry in matix

2012-07-05 Thread Bert Gunter
You have failed to provide a complete, coherent description of what you wish to do. In the absence of such a description, all suggestions are just guesses. You need to think carefully about what information you want to associate with each triangle and the appropriate data structure to use to do

Re: [R] vector entry in matix

2012-07-05 Thread Christian Brechbühler
To second Bert Gunter: you may get better answers if you give us a complete description. On Thu, Jul 5, 2012 at 12:37 PM, Thomas C. thomas.csa...@gmail.com wrote: i have number of triangles which i'd like to store in a list, matrix,...etc. i thought it could look sth. like that: triangle

Re: [R] vector entry in matix

2012-07-05 Thread Joshua Wiley
Hi Thomas, This is non trivial to do, but if you will be working with this sort of data and are inclined to do some programming, you might consider creating a new class. S4 classes and methods are quite flexible, and you can allow them to lean on or inherit from existing classes such as