Message-ID: <33D76D77E9AC4B438DA38B348ED6890D14406FC5@EMAIL.ktkdom.pte.hu>
Date: 2015-04-24T07:34:50Z
From: Kehl Dániel
Subject: cbind question, please
In-Reply-To: <CACxE24nfuh+JWDqiGOrTJ81UbdoyWJQEScPB95Kzuxy5KstuAg@mail.gmail.com>
Hello,
I am not sure what you mean by a matrix. If you want to have a matrix, use the function matrix, (matrix(c(dog,cat,tree),3))
but I have the feeling you really want a data frame as you are talking about variables.
In that case simply use
mydataframe <- data.frame(dog,cat,tree)
If you are not sure what you want, please read the intro to R pdf which is included in your installed R library.
Best regards,
daniel
________________________________________
Felad?: R-help [r-help-bounces at r-project.org] ; meghatalmazó: Erin Hodgess [erinm.hodgess at gmail.com]
K?ldve: 2015. ?prilis 24. 0:41
To: R help
T?rgy: [R] cbind question, please
Hello!
I have a cbind type question, please: Suppose I have the following:
dog <- 1:3
cat <- 2:4
tree <- 5:7
and a character vector
big.char <- c("dog","cat","tree")
I want to end up with a matrix that is a "cbind" of dog, cat, and tree.
This is a toy example. There will be a bunch of variables.
I experimented with "do.call", but all I got was
1
2
3
Any suggestions would be much appreciated. I still think that do.call
might be the key, but I'm not sure.
R Version 3-1.3, Windows 7.
Thanks,
Erin
--
Erin Hodgess
Associate Professor
Department of Mathematical and Statistics
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com
[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.