Hi, I have a series of return data, a and b are factors. I would like to
build a matrix which contains each vector of returns. I am thinking about
something as following, but I guess there should be a sensible way of doing
this.
returns - split(return, list(regimef, assetf))
cbind(returns[[1]],
livia wrote:
Hi, I have a series of return data, a and b are factors. I would like to
build a matrix which contains each vector of returns. I am thinking about
something as following, but I guess there should be a sensible way of doing
this.
returns - split(return, list(regimef, assetf))
why don't you use a 'list' as the return value. The 'cbind' is going to
assume that each of the 'return[[..]]' have the same length or you are going
to get error messages:
cbind(1:3,4:10)
[,1] [,2]
[1,]14
[2,]25
[3,]36
[4,]17
[5,]28
[6,]39
I'm trying to understand why I can rbind but not cbind dataframes to
NULLs.
For 'cbind' ('rbind'), vectors of zero length (including 'NULL')
are ignored unless the result would have zero rows (columns), for
S compatibility. (Zero-extent matrices do not occur in S3 and are
Hi, I have been trying for a while to use cbind and rbind to add a row and
column to the same table but seem to be able only to add one OR the other???
Any help would be most welcome,
Tony Evans
Australia
[[alternative HTML version deleted]]
by some R-guru, but that's part of the fun of it all!
I hope that helps, Andy
-Original Message-
From: Tony Evans [mailto:[EMAIL PROTECTED]
Sent: Monday, August 22, 2005 8:03 PM
To: Andy Bunn
Subject: Re: [R] cbind and rbind
Sorry, I did read the guide but am very new to this.
I
hi all
are we able to combine column vectors of different lengths such that the
result appears in matrix form?
e.g.
a=1
b=1:3
d=1:4
then
z=CBIND(a,b,d)
1 1 1
2 2
3 3
4
i stil want the following!
z[,1]=1
z[,2]=1:3
z[,3]=1:5
i made up the name of this function. we could use cbind
Clark Allan wrote:
hi all
are we able to combine column vectors of different lengths such that the
result appears in matrix form?
e.g.
a=1
b=1:3
d=1:4
then
z=CBIND(a,b,d)
1 1 1
2 2
3 3
4
i stil want the following!
z[,1]=1
z[,2]=1:3
z[,3]=1:5
i made up
Clark Allan wrote:
hi all
are we able to combine column vectors of different lengths such that the
result appears in matrix form?
e.g.
a=1
b=1:3
d=1:4
then
z=CBIND(a,b,d)
1 1 1
2 2
3 3
4
i stil want the following!
z[,1]=1
z[,2]=1:3
z[,3]=1:5
i made
On 8/8/05, Clark Allan [EMAIL PROTECTED] wrote:
hi all
are we able to combine column vectors of different lengths such that the
result appears in matrix form?
e.g.
a=1
b=1:3
d=1:4
then
z=CBIND(a,b,d)
1 1 1
2 2
3 3
4
i stil want the following!
z[,1]=1
On 8/8/05, Gabor Grothendieck [EMAIL PROTECTED] wrote:
On 8/8/05, Clark Allan [EMAIL PROTECTED] wrote:
hi all
are we able to combine column vectors of different lengths such that the
result appears in matrix form?
e.g.
a=1
b=1:3
d=1:4
then
z=CBIND(a,b,d)
1 1 1
Dear users,
I have a list of several matrices with the same number of columns,
how do I rbind them all with a vectorized command?
A related simpler question is, how do I vectorize the instruction
that rbinds together several copies of the same matrix?
Thanks.
--
Mauro Gasparini
On 16-Jul-05 Mauro Gasparini wrote:
Dear users,
I have a list of several matrices with the same number of columns,
how do I rbind them all with a vectorized command?
A related simpler question is, how do I vectorize the instruction
that rbinds together several copies of the same matrix?
(Ted Harding) [EMAIL PROTECTED] writes:
On 16-Jul-05 Mauro Gasparini wrote:
Dear users,
I have a list of several matrices with the same number of columns,
how do I rbind them all with a vectorized command?
A related simpler question is, how do I vectorize the instruction
that
Didn't you simply try:
A-matrix(c(1.1,1.2,1.3,1.4,1.5,1.6),ncol=3)
B-matrix(c(2.1,2.2,2.3,2.4,2.5,2.6),ncol=3)
C-matrix(c(3.1,3.2,3.3,3.4,3.5,3.6),ncol=3)
A
[,1] [,2] [,3]
[1,] 1.1 1.3 1.5
[2,] 1.2 1.4 1.6
B
[,1] [,2] [,3]
[1,] 2.1 2.3 2.5
[2,] 2.2 2.4 2.6
Gabor Grothendieck wrote:
michael watson (IAH-C michael.watson at bbsrc.ac.uk writes:
:
: Hi
:
: I'm seeing some odd behaviour with cbind(). My code is:
:
: cat - read.table(cogs_category.txt, sep=\t, header=TRUE,
: quote=NULL, colClasses=character)
: colnames(cat)
: [1] Code
cat is a data.frame,
so cbind is use for a data.frame
and
?data.frame tell us that:
Character variables passed to 'data.frame' are converted
to factor columns unless protected by 'I'.
PS : it is not good ides to call your data.frame cat as there is a cat
function.
At 09:19 10/12/2004,
This is of the nature of an FAQ. Data frames coerce character
vectors into factors. If you want a character vector to stay
that way (and not become a factor) wrap in up in ``I()'':
cat - cbind(cat,Color=I(rainbow(nrow(cat
(There's no need to quote the name ``Color'' in the
michael watson (IAH-C michael.watson at bbsrc.ac.uk writes:
:
: Hi
:
: I'm seeing some odd behaviour with cbind(). My code is:
:
: cat - read.table(cogs_category.txt, sep=\t, header=TRUE,
: quote=NULL, colClasses=character)
: colnames(cat)
: [1] CodeDescription
:
Probably you called the build-in rainwbow-function, which returns a string.
str(rainbow(10))
chr FF
Dieter Menne
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
Dear all,
I have a problem with adding columns to a data structure, using 'cbind':
I create an array, to which I want to cbind one new colum for every
iteration of a loop. Without the loop, the code works and looks like this:
Min- array(0,c(129,0))
Min
[1,]
[2,]
[3,]
[4,]
etc..
file -
Jan Wantia wrote:
Dear all,
I have a problem with adding columns to a data structure, using 'cbind':
I create an array, to which I want to cbind one new colum for every
iteration of a loop. Without the loop, the code works and looks like this:
Min- array(0,c(129,0))
Min
[1,]
[2,]
[3,]
cbind on vectors/matrices which are not atomic is unsupported: we had a
bug report on that within the last 24 hours (but it seems to be
intentional).
You can just concatenate the lists and add a suitable dimension:
res - c(ll, sym)
dim(res) - c(508,2)
if I understand your intentions.
I think.
= try.txt)
Error in cbind(...) : cannot create a matrix from these types
-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
Sent: Sat 3/27/2004 3:30 PM
To: Han, Hillary
Cc: [EMAIL PROTECTED]
Subject:Re: [R] cbind question
cbind on vectors/matrices which
: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
Sent: Sat 3/27/2004 3:30 PM
To: Han, Hillary
Cc: [EMAIL PROTECTED]
Subject: Re: [R] cbind question
cbind on vectors/matrices which are not atomic is unsupported: we had a
bug report on that within the last 24 hours (but it seems
: Sat 3/27/2004 3:30 PM
: To: Han, Hillary
: Cc: r-help at stat.math.ethz.ch
: Subject: Re: [R] cbind question
: cbind on vectors/matrices which are not atomic is unsupported: we had a
: bug report on that within the last 24 hours (but it seems to be
: intentional).
:
: You can just
Hello!
I'm not grasping why cbind (in the code below) warns that
Warning message:
number of rows of result
is not a multiple of vector length (arg 2) in: cbind(z, p)
when I do
sections - function(length, parts)
{
p - 1:parts
q - length %/% parts
z - array(p,
Paul Lemmens [EMAIL PROTECTED] writes:
Hello!
I'm not grasping why cbind (in the code below) warns that
Warning message:
number of rows of result
is not a multiple of vector length (arg 2) in: cbind(z, p)
when I do
sections - function(length, parts)
{
p - 1:parts
orkun [EMAIL PROTECTED] writes:
Hello
I need to use this command:
cbind(ftable(xtabs(cnt~geo+slp+con+hey,data=dt3))
hey is in count of success /failure value
but cbind gives failure/success counts. I want to change the order of
this cbind as success /failure counts.
for instance:
I
29 matches
Mail list logo