Hello Erin,
I think you have explain your goal more detailed. Maybe I am completely
lost but as far as I understand now you only need the command cbind:
m1 <- cbind(dog, dat, tree)
dog cat tree
[1,] 1 25
[2,] 2 36
[3,] 3 47
But I can't imagine that is the solution yo
You could do something tricky like
> do.call(cbind, lapply(big.char, as.name))
dog cat tree
[1,] 1 25
[2,] 2 36
[3,] 3 47
but you are usually better off creating these things as part of a list
and passing that to do.call(cbind, list).
There is a slight danger
I am amazed at the number of rather obtuse misunderstandings of the
actual nature of Erin's question.
The suggestion that Erin should read the intro to R made me smile. Erin
is a long time and highly sophisticated user of R; she has no need to
read the intro. The person who made that sugge
f Of Erin
Hodgess
> Sent: Friday, 24 April 2015 10:41a
> To: R help
> Subject: [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
>
G'day Erin,
On Thu, 23 Apr 2015 20:51:18 -0400
Erin Hodgess wrote:
> Here is the big picture. I have a character vector with all of the
> names of the variables in it.
>
> I want to "cbind" all of the variables to create a matrix.
>
> Doing 3 is straightforward, but many, not so much.
So I g
Is this what you're looking for?
> dog <- 1:3
> bat <- 2:4
> tree <- 5:7
> big.char <- c("dog","bat","tree")
> do.call(cbind,lapply(big.char, get))
[,1] [,2] [,3]
[1,]125
[2,]236
[3,]347
>
On Thu, Apr 23, 2015 at 3:41 PM, Erin Hodgess wrote:
> Hello!
: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
On 24/04/15 10:41, Erin Hodgess wrote:
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 e
ot;4", "5", "6", "7", "dog",
"cat", "tree"), .Dim = 3:4, .Dimnames = list(NULL, c("dog", "cat",
"tree", "big.char")))
John Kane
Kingston ON Canada
> -Original Message-
> From: eri
tructure(c("1", "2", "3", "2", "3", "4", "5", "6", "7", "dog",
> "cat", "tree"), .Dim = 3:4, .Dimnames = list(NULL, c("dog", "cat",
> "t
On Apr 23, 2015, at 5:41 PM, Erin Hodgess wrote:
>
> 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
: Friday, 24 April 2015 10:41a
To: R help
Subject: [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
These are great! Thank you!
On Thu, Apr 23, 2015 at 7:14 PM, William Dunlap wrote:
> You could do something tricky like
> > do.call(cbind, lapply(big.char, as.name))
>dog cat tree
> [1,] 1 25
> [2,] 2 36
> [3,] 3 47
> but you are usually better off creat
Perhaps:
dog <- 1:3
cat <- 2:4
tree <- 5:7
big.char <- cbind(dog,cat,tree)
big.char
dog cat tree
[1,] 1 25
[2,] 2 36
[3,] 3 47
colnames(big.char)<-c("dog","cat","tree")
big.char
dog cat tree
[1,] 1 25
[2,] 2 36
[3,] 3 47
Clint Bowma
Hi Erin,
Well, if I do this:
dog <- 1:3
cat <- 2:4
tree <- 5:7
dct<-cbind(dog,cat,tree)
I get this:
dct
dog cat tree
[1,] 1 25
[2,] 2 36
[3,] 3 47
If I assume that you want to include the character vector as well:
rownames(dct)<-big.char
dct
Jim
On Fri, Apr 24, 2
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 variabl
ber 9, 2014 7:37 AM
To: Evan Cooch; r-help@r-project.org
Subject: Re: [R] cbind in a loop...better way? | summary
Two solutions proposed -- not entirely orthogonal, but both do the
trick. Instead of nesting cbin in a loop (as I did originally -- OP,
below),
1\ do.call(cbind, lapply(mat_list, as.v
ilto:r-help-boun...@r-project.org]
> On Behalf Of Evan Cooch
> Sent: Thursday, October 9, 2014 7:37 AM
> To: Evan Cooch; r-help@r-project.org
> Subject: Re: [R] cbind in a loop...better way? | summary
>
> Two solutions proposed -- not entirely orthogonal, but both do the
> trick.
t.org
Subject: Re: [R] cbind in a loop...better way? | summary
Two solutions proposed -- not entirely orthogonal, but both do the
trick. Instead of nesting cbin in a loop (as I did originally -- OP,
below),
1\ do.call(cbind, lapply(mat_list, as.vector))
or
2\ sapply(mat_list,function(x) as.vec
Two solutions proposed -- not entirely orthogonal, but both do the
trick. Instead of nesting cbin in a loop (as I did originally -- OP,
below),
1\ do.call(cbind, lapply(mat_list, as.vector))
or
2\ sapply(mat_list,function(x) as.vector(x))
Both work fine. Thanks to Jeff Laake (2) + David
ion, TX 77840-4352
>
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Evan Cooch
> Sent: Wednesday, October 8, 2014 2:13 PM
> To: r-help@r-project.org
> Subject: [R] cbind in a loop...better way?
>
> .
ent of Anthropology
Texas A&M University
College Station, TX 77840-4352
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Evan Cooch
Sent: Wednesday, October 8, 2014 2:13 PM
To: r-help@r-project.org
Subject: [R] cbind in a loop..
...or some such. I'm trying to work up a function wherein the user
passes a list of matrices to the function, which then (1) takes each
matrix, (2) performs an operation to 'vectorize' the matrix (i.e., given
an (m x n) matrix x, this produces the vector Y of length m*n that
contains the colum
Hi,
The rownames part is not clear as your expected output and input files didn't
show them as rownames.
##Suppose you have all the files in a folder
##here I am creating the names of those files
files1 <- paste0("sample", rep(1:777, each=29),"chr",1:29,".txt")
length(files1)
#[1] 22533
lst1 <
In addition to what the others have told you, it looks like you might
be confusing
matrices with data.frames. Please see
?data.frame
I think what you are looking for is
> b <- c('a','b','c')
> c <- c("ee","tt","rr")
> k <- cbind(a,b,c)
> K <- data.frame(a, b, c)
> K
a b c
1 1 a ee
2 2 b tt
3
Hard to say, not sure what you want to do. But the columns are not denoted by
[a], [b] or [c]. You should learn to use the str function to understand what
various expressions really are, and return to the "Introduction to R" document
that comes with the software. There is a distinct difference b
Hi,
Try:
k[,"a"]
#[1] "1" "2" "3"
k[,"b"]
#[1] "a" "b" "c"
k[,"c"]
#[1] "ee" "tt" "rr"
A.K.
On Tuesday, October 22, 2013 11:37 PM, Vivek Singh
wrote:
Hi All,
I have create a matrix using cbind() function as follows:
> a=c(1,2,3)
> b=c('a','b','c')
> c=c("ee","tt","rr")
> k=cbi
Hi All,
I have create a matrix using cbind() function as follows:
> a=c(1,2,3)
> b=c('a','b','c')
> c=c("ee","tt","rr")
> k=cbind(a,b,c)
Problem: when we print the matrix k,
> k
a b c
[1,] "1" "a" "ee"
[2,] "2" "b" "tt"
[3,] "3" "c" "rr"
we can see that rows are represented
Hi,
I can't seem to get this to work:
http://www.endmemo.com/program/R/cbind.php
Do I save the data as data1.csv in note pad and pull in the file? Do I type
data1.csv<-Subtype,Gender,Expression,A,m,-0.54,A,f,-0.8,B,f,-1.03,C,m,-0.41??
I can do a simple matrix. But, I want to have headers and dat
Hi,
You can save it in file. I copy and paste:
Subtype,Gender,Expression
A,m,-0.54
A,f,-0.8
B,f,-1.03
C,m,-0.41
on the "gedit" and save it as "data1.csv". You might be able to do the same
with notepad.
x <- read.csv("data1.csv",header=T,sep=",")
x2 <- read.csv("data2N.csv",header=T,sep=",")
Hello all,
I posted a question about cbind and an error when specifying the check.names
argument here:
http://stackoverflow.com/questions/17810470/cbind-error-with-check-names
I was advised to take this to R-devel, but before that, I'd like to get the
opinions of people on this list.
Thanks
That's a nice solution. Thanks.
Sent from my iPhone
On Apr 9, 2013, at 10:00 AM, Gabor Grothendieck wrote:
On Tue, Apr 9, 2013 at 9:15 AM, Harry Mamaysky wrote:
> That's true. So perhaps there should be a flag that turns on this error
> checking. Often "args" is just a list that gets generat
On Tue, Apr 9, 2013 at 9:15 AM, Harry Mamaysky wrote:
> That's true. So perhaps there should be a flag that turns on this error
> checking. Often "args" is just a list that gets generated automatically and
> you don't know what all of its elements are. It just leads to a bit of
> non-determinis
That's true. So perhaps there should be a flag that turns on this error
checking. Often "args" is just a list that gets generated automatically and you
don't know what all of its elements are. It just leads to a bit of
non-deterministic behavior. It would be useful to have the option of flagging
On Tue, Apr 9, 2013 at 7:31 AM, Harry Mamaysky wrote:
> Thanks for the explanations.
>
> Wouldn't the following bit of checking in do.call() make it easier to figure
> such things out in the future?
>
Sure, it would have helped you figure out your issue, but you don't
want a *warning* when you pu
Thanks for the explanations.
Wouldn't the following bit of checking in do.call() make it easier to figure
such things out in the future?
my.call <- function(what,args,...) {
## Get the name of the function to call.
if (!is.character(what))
whatStr <- deparse(substitute(what))
el
On Mon, Apr 8, 2013 at 3:54 PM, Harry Mamaysky wrote:
> Can someone explain why this happens when one of the list elements is named
> 'all'?
>
>> zz <- list( zoo(1:10,1:10), zoo(101:110,1:10), zoo(201:210,1:10) )
>> names(zz)<-c('test','bar','foo')
>> do.call(cbind,zz)
>test bar foo
> 1
Because 'all' is the name of one of the arguments to cbind.zoo:
R> args(cbind.zoo)
function (..., all = TRUE, fill = NA, suffixes = NULL, drop = FALSE)
NULL
do.call constructs a call somewhat like:
R> cbind(test=zz$test, all=zz$all, foo=zz$foo)
The same thing would happen f
Can someone explain why this happens when one of the list elements is named
'all'?
> zz <- list( zoo(1:10,1:10), zoo(101:110,1:10), zoo(201:210,1:10) )
> names(zz)<-c('test','bar','foo')
> do.call(cbind,zz)
test bar foo
1 1 101 201
2 2 102 202
3 3 103 203
4 4 104 204
5 5 1
Short answer: there is a default method used here which returns a matrix. It's
defined at the C-level for speed so you don't see it with methods()
Longer: cbind() isn't a regular S3 generic since it has no UseMethod(). Look at
WRE and R-Internals (internal generics) for more info.
Best (and go
## Hi, I'm having trouble understanding how the cbind function decides what
method to apply to its arguments. Easy cut and paste code below.
>
>
>
> ## create two columns
> c1 <- c("A","A","B","B")
> c2 <- 1:4
>
> ## cbind outputs a matrix with elements that are characters, seems
reasonable
Hi, we have a problem concerning the use and forecasting on the GARCH (1, 1) on
financial data.
We would like to make predictions on future returns in a loop which moves the
window of estimation forward one unit for each iteration. Our code is as
follows:
> BJORN <- read.table("C:/Users/Osvald
On Apr 10, 2012, at 12:19 PM, David Winsemius wrote:
On Apr 10, 2012, at 11:58 AM, Rainer Schuermann wrote:
cbind() works as well, but only if c is attached to the existing
test variable:
tst <- cbind( test, c )
tst
ab c
1 1 0.3 y1
2 2 0.4 y2
3 3 0.5 y3
4 4 0.6 y4
5
On Apr 10, 2012, at 11:58 AM, Rainer Schuermann wrote:
cbind() works as well, but only if c is attached to the existing
test variable:
tst <- cbind( test, c )
tst
ab c
1 1 0.3 y1
2 2 0.4 y2
3 3 0.5 y3
4 4 0.6 y4
5 5 0.7 y5
str( tst )
'data.frame': 5 obs. of 3 va
Sorry, I missed that the OP's real question was in character/factor,
not in the "why are these all factors" bit...good catch.
Rant about cbind() still stands though. :-) [Your way with cbind()
would give him all characters, not some characters and some numerics
since cbind() gives a matrix by de
cbind() works as well, but only if c is attached to the existing test variable:
> tst <- cbind( test, c )
>
> tst
>
ab
Still didn't work for me without cbind , although you really don't need it ;)
worked after i set options(stringsAsFactors=F).
> options(stringsAsFactors=F)
> df<-data.frame(intVec,chaVec)
> df
intVec chaVec
1 1 a
2 2 b
3 3 c
> df$chaVec
[1] "a" "b" "c"
documentat
Don't use cbind() -- it forces everything into a single type, here
string, which in turn becomes factor.
Simply,
data.frame(a, b, c)
Like David mentioned a few days ago, I have no idea who is promoting
this data.frame(cbind(...)) idiom, but it's a terrible idea (albeit
one that seems to be very
Complete newbie to R -- struggling with something which should be pretty
basic. Trying to create a simple data set (which I gather R refers to as a
data.frame). So
> a <- c(1,2,3,4,5);
> b <- c(0.3,0.4,0.5,0,6,0.7);
Stick the two together into a data frame (call test) using cbind
> test <- dat
What is it you want to do with the data after you save it? Are you
just going to read it back into R? If so, consider using save/load.
On Fri, Jan 6, 2012 at 12:43 PM, Mary Kindall wrote:
> I have two one dimensional list of elements and want to perform cbind and
> then write into a file. The n
Sorry Mary,
My function would write the remainder twice, I had only tested it
with multiples of the chunk size.
(And without looking at the lenghty output correctly.)
Now checked:
write.big.matrix <- function(x, y, outfile, nmax=1000){
if(file.exists(outfile)) unlink(outfile)
testf <- f
Hello,
I believe this function can handle a problem of that size, or bigger.
It does NOT create the full matrix, just writes it to a file, a certain
number of lines at a time.
write.big.matrix <- function(x, y, outfile, nmax=1000){
if(file.exists(outfile)) unlink(outfile)
testf
On Jan 6, 2012, at 12:39 PM, Marc Schwartz wrote:
> On Jan 6, 2012, at 11:43 AM, Mary Kindall wrote:
>
>> I have two one dimensional list of elements and want to perform cbind and
>> then write into a file. The number of entries are more than a million in
>> both lists. R is taking a lot of time
On Jan 6, 2012, at 12:43 PM, Mary Kindall wrote:
I have two one dimensional list of elements and want to perform
cbind and
then write into a file. The number of entries are more than a
million in
both lists. R is taking a lot of time performing this operation.
Is there any alternate way to
On Jan 6, 2012, at 11:43 AM, Mary Kindall wrote:
> I have two one dimensional list of elements and want to perform cbind and
> then write into a file. The number of entries are more than a million in
> both lists. R is taking a lot of time performing this operation.
>
> Is there any alternate way
, 2012 12:43 PM
To: r-help@r-project.org
Subject: [R] cbind alternate
I have two one dimensional list of elements and want to perform cbind
and then write into a file. The number of entries are more than a
million in both lists. R is taking a lot of time performing this
operation.
Is there any
I have two one dimensional list of elements and want to perform cbind and
then write into a file. The number of entries are more than a million in
both lists. R is taking a lot of time performing this operation.
Is there any alternate way to perform cbind?
x = table1[1:100,1]
y = table2[1:100
Note that this issue was raised on StackOverflow recently.
http://stackoverflow.com/questions/7678090/xts-merge-odd-behaviour
Here's the solution:
index(a) <- index(a)
index(b) <- index(b)
merge(a,b)
ZWD.UGX SCHB.Close
2010-03-31 NA 28.02
2010-04-01 7.6343 NA
2010-04
This seems to be the easiest way to handle the problem:
> a = xts(coredata(a), time(a))
> b = xts(coredata(b), time(b))
> merge(a,b)
ZWD.UGX SCHB.Close
2010-03-31 NA 28.02
2010-04-01 7.6343 NA
2010-04-02 7.6343 NA
2010-04-03 7.5458 NA
2010-04-04 7
I was rather too quick
It has probably something to do with versions of zoo and xts
after updating to zoo 1.7.4 and xts 0.8.2 I got with your examples
> merge(a,b)
ZWD.UGX SCHB.Close
2010-04-01 NA 28.02
2010-04-01 7.6343 NA
2010-04-02 7.6343 NA
2010-04-03
Hi:
Try this:
require('xts')
merge.zoo(zoo(a), zoo(b), all = c(TRUE, TRUE))
ZWD.UGX SCHB.Close
2010-03-31 NA 28.02
2010-04-01 7.6343 NA
2010-04-02 7.6343 NA
2010-04-03 7.5458 NA
2010-04-04 7.4532 28.30
2010-04-05 7.4040 28.38
2010-04-06
Hi
>
> On 26 August 2011 03:37, R. Michael Weylandt
wrote:
> > If you could, dput() them so we can see everything about them. You
also
> > might see if merge() gives you more expected behavior
>
> Ok...
> > dput(a)
> structure(c(7.6343, 7.6343, 7.5458, 7.4532, 7.404, 7.3317), class =
c("
On 26 August 2011 03:37, R. Michael Weylandt wrote:
> If you could, dput() them so we can see everything about them. You also
> might see if merge() gives you more expected behavior
Ok...
> dput(a)
structure(c(7.6343, 7.6343, 7.5458, 7.4532, 7.404, 7.3317), class = c("xts",
"zoo"), .indexCLAS
Hmm, that's quite puzzling. I don't know but I'd willing to guess the
time/date stamps on a,b are more different than the output is leading us to
believe. My experience is that there's always more to a time/date object to
trick us up than one would expect.
If you could, dput() them so we can see e
I have two xts objects, call them "a" and "b", and am trying to merge them...
> class(a)
[1] "xts" "zoo"
> class(b)
[1] "xts" "zoo"
> head(a)
2010-04-01 7.6343
2010-04-02 7.6343
2010-04-03 7.5458
2010-04-04 7.4532
2010-04-05 7.4040
2010-04-06 7.3317
> head(b)
2010-04-01 568.80
2010-04-05
On Jul 15, 2011, at 15:06 , peter dalgaard wrote:
> For a little lateral thinking, consider the use of "." on the LHS. That could
> play out as follows:
>
>> myvars <- c("Ozone","Wind")
>> f <- . ~ Month
>> j <- union(all.vars(f[[3]]), myvars)
>> aggregate(. ~ Month, data=airquality[j], mean, n
s the same result as
>
> aggregate(cbind(mpg, wt) ~ cyl + gear, FUN=median, data=mtcars)
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behal
For a little lateral thinking, consider the use of "." on the LHS. That could
play out as follows:
> myvars <- c("Ozone","Wind")
> f <- . ~ Month
> j <- union(all.vars(f[[3]]), myvars)
> aggregate(. ~ Month, data=airquality[j], mean, na.rm=T)
MonthOzone Wind
1 5 23.61538 11.457692
Hi:
I think Bill's got the right idea for your problem, but for the fun of
it, here's how Bert's suggestion would play out:
# Kind of works, but only for the first variable in myvars...
> aggregate(get(myvars) ~ group + mydate, FUN = sum, data = example)
group mydate get(myvars)
1 group1 2
iakhovitski
Sent: Thursday, July 14, 2011 1:45 PM
To: David Winsemius
Cc: r-help
Subject: Re: [R] cbind in aggregate formula - based on an existing object
(vector)
Thanks a lot!
actually, what I tried to do is very simple - just passing tons of
variable names into the formula. Maybe that "
David - I tried exactly the thing you did (and after that asked my
question to the forum):
> form <- as.formula(paste(
> "cbind(",
> paste( myvars, collapse=","),
> ") ~ group+mydate",
> sep=" ") )
And it did not wo
Thanks a lot!
actually, what I tried to do is very simple - just passing tons of
variable names into the formula. Maybe that "get" thing suggested by
Bert would work...
Dimitri
On Thu, Jul 14, 2011 at 4:01 PM, David Winsemius wrote:
> Dmitri:
>
> as.matrix makes a matrix out of the dataframe t
Dmitri:
as.matrix makes a matrix out of the dataframe that is passed to it.
As a further note I attempted and failed for reasons that are unclear
to me to construct a formula that would (I hoped) preserve the column
names which are being mangle in the posted effort:
form <- as.formula(past
Dmitri:
Look at my vars from myvars<-c("value1","value2")
It's just a character vector of length 2!
You can't cbind a character vector of length 2! These are not
references/pointers.
It's not at all clear to me what you ultimately want to do, but IF
it's: pass a character vector of names to be u
Thank you, David, it does work.
Could you please explain why? What exactly does changing it to "as matrix" do?
Thank you!
Dimitri
On Thu, Jul 14, 2011 at 3:25 PM, David Winsemius wrote:
>
> On Jul 14, 2011, at 3:05 PM, Dimitri Liakhovitski wrote:
>
>> Hello!
>>
>> I am aggregating using a formula
On Jul 14, 2011, at 3:05 PM, Dimitri Liakhovitski wrote:
Hello!
I am aggregating using a formula in aggregate - of the type:
aggregate(cbind(var1,var2,var3)~factor1+factor2,sum,data=mydata)
However, I actually have an object (vector of my variables to be
aggregated):
myvars<-c("var1","var2
Hello!
I am aggregating using a formula in aggregate - of the type:
aggregate(cbind(var1,var2,var3)~factor1+factor2,sum,data=mydata)
However, I actually have an object (vector of my variables to be aggregated):
myvars<-c("var1","var2","var3")
I'd like my aggregate formula (its "cbind" part) to b
Jim -
In what sense does cbind(A,B,C) not work?
A = matrix(rnorm(10),5,2)
B = matrix(rnorm(15),5,3)
C = matrix(rnorm(20),5,4)
cbind(A,B,C)
[,1] [,2] [,3] [,4] [,5][,6]
[1,] -0.54194873 -1.1105170 -0.479010 0.619911163 0.1610162 0.49028633
[2,]
A, B, C should have the same number of rows.
mlist = replicate(3, matrix(rnorm(6), 2), simplify=FALSE)
names(mlist) = LETTERS[seq_along(mlist)]
with(mlist, cbind(A,B,C))
or,
do.call(cbind, mlist)
HTH,
baptiste
On 5 June 2011 11:14, Jim Silverton wrote:
> How can I cbind three or more matrice
do.call(cbind, list(A, B, C))
On Sat, Jun 4, 2011 at 7:14 PM, Jim Silverton wrote:
> How can I cbind three or more matrices like A,B and C. This does not work:
>
> cbind(A,B,C)
>
>
> --
> Thanks,
> Jim.
>
--
Sarah Goslee
http://www.functionaldiversity.org
_
How can I cbind three or more matrices like A,B and C. This does not work:
cbind(A,B,C)
--
Thanks,
Jim.
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the
Hello jholtman,
Thanks very much for the suggestion.
I tried using "as.is=TRUE" and it worked as the way I expected. Sorry for
not being clear about the problem in my mail.
The characters are very much needed, cos I am trying to create a signaling
network using "Rgraphviz".
Thanks again.
Regar
This comes about since when using read.table (which I assume you did,
but you did not show us what commands you were using), characters are
converted to factors. If you are not using factors, then you probably
want the data read in as characters. You should understand the use of
'str' to look at
I am new to R and request your kind help.
I have a table like the one below,
one two
1 apple fruit
2 ball game
3 chair wood
4 wood plain
5 fruitbanana
6 cloth silk
Note: duplicate entries are there
the task is to create relations to each
Thanks.
On Aug 21, 2010, at 4:01 PM, RICHARD M. HEIBERGER wrote:
cbind(A=x, B=y)
On Sat, Aug 21, 2010 at 6:53 PM, r.ookie wrote:
Is there a way to rename the columns to something like A and B in the cbind
function?
x <- rnorm(n = 10, mean = 0, sd = 1)
y <- rnorm(n = 10, mean = 0, sd = 1)
cb
On 2010-08-21 16:53, r.ookie wrote:
Is there a way to rename the columns to something like A and B in the cbind
function?
x<- rnorm(n = 10, mean = 0, sd = 1)
y<- rnorm(n = 10, mean = 0, sd = 1)
cbind(x,y)
Unless I completely misunderstand your query, ?cbind tells you:
"... vectors or matri
cbind(A=x, B=y)
On Sat, Aug 21, 2010 at 6:53 PM, r.ookie wrote:
> Is there a way to rename the columns to something like A and B in the cbind
> function?
>
> x <- rnorm(n = 10, mean = 0, sd = 1)
> y <- rnorm(n = 10, mean = 0, sd = 1)
> cbind(x,y)
>
> ___
Is there a way to rename the columns to something like A and B in the cbind
function?
x <- rnorm(n = 10, mean = 0, sd = 1)
y <- rnorm(n = 10, mean = 0, sd = 1)
cbind(x,y)
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
Hi there,
I need to merge/bind two time series objects (from RPackage: timeSeries) by
column. The theory is laid out nicely, even for overlapping indices.
In my example, I have overlapping indices ("01.01.2001"), where in one time
series I have one data point and in the other redundant data.
Try this:
do.call(cbind, lapply(dir(pattern = '.out3$'), read.table))
On Mon, Jul 12, 2010 at 1:08 AM, jd6688 wrote:
>
> I have 30 files in the current directories, i would like to perform the
> cbind(fil1,file2,file3,file4file30)
>
> how could i do this in a for loop:
>
> such as:
> fi
On Jul 12, 2010, at 2:32 AM, Joshua Wiley wrote:
Hi,
Assuming that you have read the files into R,
and that their names (in R) are held in some object
(e.g., 'file2'), then this works
do.call(what = cbind, args = mget(x = file2, envir = .GlobalEnv)
Here is a reproducible example:
x1 <- data
Hi,
Assuming that you have read the files into R,
and that their names (in R) are held in some object
(e.g., 'file2'), then this works
do.call(what = cbind, args = mget(x = file2, envir = .GlobalEnv)
Here is a reproducible example:
x1 <- data.frame(x = 1:10)
x2 <- data.frame(y = 1:10)
file.name
I have 30 files in the current directories, i would like to perform the
cbind(fil1,file2,file3,file4file30)
how could i do this in a for loop:
such as:
file2 <- list.files(pattern=".out3$")
for (j in file2) {
cbind(j)...how to implement cbind here
}
Thanks.
I wrote a function that cbinds vectors of different lengths. Basically, the
function adds NAs to shorter vectors and cbinds in the end. I'm attaching
the code for guidance.
# This function takes in a list() of vectors and cbinds them into a
data.frame.
timerMelt <- function(x, write.down = FALSE,
Hello R help
I have a dataframe, with 71 samples (rows) and 30 variables. I got linear
models for some of the variables, and I want to join fitted and residuals of
these models to the data frame. Sometimes, these vectors have the same length
of the dependant variable, but in a few cases, NA va
On 01.05.2010 21:09, Giovanni Azua wrote:
Hello,
I have three method types and 100 generalization errors for each, all in the
range [0.65,0.81]. I would like to make a stacked histogram plot using ggplot2
with this data ...
Therefore I need a data frame of the form e.g.
Method
Hello,
I have three method types and 100 generalization errors for each, all in the
range [0.65,0.81]. I would like to make a stacked histogram plot using ggplot2
with this data ...
Therefore I need a data frame of the form e.g.
Method GE
-- --
Hi!
29.01.2010 12:49, soeren.vo...@eawag.ch wrote:
> Hello,
>
> I read the help as well as the examples, but I can not figure out why
> the following code does not produce the *given* row names, "x" and "y":
>
> x <- 1:20
> y <- 21:40
> rbind(
> x=cbind(N=length(x), M=mean(x), SD=sd(x)),
> y
This gives what you want:
rbind.data.frame(
x=cbind(N=length(x), M=mean(x), SD=sd(x)),
y=cbind(N=length(y), M=mean(y), SD=sd(y))
)
On Fri, Jan 29, 2010 at 8:49 AM, wrote:
> Hello,
>
> I read the help as well as the examples, but I can not figure out why the
> following code does not produc
Hello,
I read the help as well as the examples, but I can not figure out why
the following code does not produce the *given* row names, "x" and "y":
x <- 1:20
y <- 21:40
rbind(
x=cbind(N=length(x), M=mean(x), SD=sd(x)),
y=cbind(N=length(y), M=mean(y), SD=sd(y))
)
Could you please help?
1 - 100 of 141 matches
Mail list logo