Message-
From: CALUM POLWART
To: Bert Gunter
Cc: r-help@R-project.org ; Stefano Sofia
Sent: Fri, Jun 3, 2022 3:48 am
Subject: Re: [R] rbind of multiple data frames by column name, when each data
frames can contain different columns
Bert! It sounds like you are warming to the the tidyverse
arche Region - Italy
Meteo Section
Snow Section
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona (AN)
Uff: +39 071 806 7743
E-mail: stefano.so...@regione.marche.it
---Oo-oO
____________
Da: Andrew Simmons
Inviato: venerd� 3
Thank you, that was it.
Best,
Milu
On Wed, Jan 20, 2021 at 1:33 PM Eric Berger wrote:
> for ( file in filelist )
>
>
>
> On Wed, Jan 20, 2021 at 2:21 PM Miluji Sb wrote:
>
>> Thank you for your reply and the solution. Yes, I would like the date to
>> be
>> the column header for all the files
for ( file in filelist )
On Wed, Jan 20, 2021 at 2:21 PM Miluji Sb wrote:
> Thank you for your reply and the solution. Yes, I would like the date to be
> the column header for all the files in the list.
>
> This is what tried following your suggestion;
>
> filelist = list.files(pattern = ".*.t
Thank you for your reply and the solution. Yes, I would like the date to be
the column header for all the files in the list.
This is what tried following your suggestion;
filelist = list.files(pattern = ".*.txt")
date <- 2101
for (file %in% filelist){
datalist <- read.table(file)
write.t
a) I recommend _not_ overwriting the input files. Very difficult to
debug/recover if anything goes wrong.
b) I recommend making a function that takes the file name, source directory,
and destination directory, and reads the file, makes the change, and writes it
to the output directory.
c) Your
Hello Rui and Gerrit and Sarah,
Thank you very much for your help. I finally got it to work!
Have a great day!
Dagmar
Am 29.10.2015 um 08:38 schrieb ruipbarra...@sapo.pt:
>
> Hello,
>
> Try the following.
>
>
> newframe <- myframe
> newframe$Hungertype <- with(myframe, ifelse(Hunger <= 1, NA,
>
Hello, Sarah,
take a look at the online help page of the function cut() (and apply the
function to the Hunger-column).
Hth -- Gerrit
On Thu, 29 Oct 2015, Dagmar wrote:
Dear Sarah, (dear All),
Thank you for trying to help! You are right, that I want to add a column to
my dataframe with a
Hello,
Try the following.
newframe <- myframe
newframe$Hungertype <- with(myframe, ifelse(Hunger <= 1, NA,
ifelse(1 < Hunger & Hunger
<= 2, "Hunger",
ifelse(Hunger < 3,
"bigHUnger", "verybigHunger") )))
Note that the new column is of type c
Dear Sarah, (dear All),
Thank you for trying to help! You are right, that I want to add a column
to my dataframe with a corresponding value to the Hunger column.
Your solution is basically correct in the result but my data are a
little more complicated. Maybe that example describes it better:
If I'm reading this correctly, you want to add a column to your
dataframe with a name corresponding to the value in the Hunger column.
myframe <- data.frame (ID=c("Ernie", "Ernie", "Ernie", "Bert",
"Bert","Bert", "Duck"), Hunger=c(1,1,1,2,2,1,3) )
myframe$Hungertype <- c("none", "bighunger", "ver
Hello,
Em 12-10-2014 18:26, David Winsemius escreveu:
On Oct 12, 2014, at 8:45 AM, Rui Barradas wrote:
Hello,
Try the following.
do.call(rbind, lapply(a, '[[', "var1"))
do.call(rbind, lapply(a, '[[', "var2"))
Could perhaps (untested) make it more general with:
do.call(rbind, lapply(a, '[
On Oct 12, 2014, at 8:45 AM, Rui Barradas wrote:
> Hello,
>
> Try the following.
>
> do.call(rbind, lapply(a, '[[', "var1"))
> do.call(rbind, lapply(a, '[[', "var2"))
Could perhaps (untested) make it more general with:
do.call(rbind, lapply(a, '[[', names(a[[1]])[1]))
do.call(rbind, lapply(a,
Hello,
Try the following.
do.call(rbind, lapply(a, '[[', "var1"))
do.call(rbind, lapply(a, '[[', "var2"))
Hope this helps,
Rui Barradas
Em 12-10-2014 07:14, Cesar Caballero escreveu:
Hi all,
I have an array of lists. All lists have the same names and the vectors inside
each name have the
Hi,
If your working directory is "data 3" which has only two folders C1 and C2.
May be this helps:
lsF1 <- list.files(recursive=TRUE)
lst1 <- lapply(split(lsF1,gsub(".*\\_(\\d+)\\..*","\\1",lsF1)),function(x)
do.call(rbind,lapply(x,function(y) read.csv(y, header=TRUE
A.K.
Hello,
I am tryi
Thank you,
now it works. I would never have never found the source of the problem.
I am trying
to build a data frame with results from a sensitivity analysis
for a model. I use rbind because the number of rows is
unkown and i use the timestamp as a hint for the students
that they do not analyse
try this:
> sensitivity=rbind(sensitivity,data.frame(mtype=2,cdate=as.POSIXct(Sys.time(),
> origin="1970-01-01")))
> sensitivity
mtype cdate
1 1 2013-12-10 09:35:53
2 2 2013-12-10 09:37:02
The 'c' function is coercing to numeric. If you want to 'rbind' rows
to a datafram
On 07-03-2013, at 17:52, Heath Blackmon wrote:
> I have a large list of matrices and a vector that identifies the desired
> matrices that I would like to rbind. However, I am stuck on how to get
> this to work. I have written some code below to illustrate my problem:
>
> # 3 simple matrices
>
?do.call
## as in
do.call(rbind, list_of_matrices)
## Note that list_of_matrices must be a **list**.
-- Bert
On Thu, Mar 7, 2013 at 8:52 AM, Heath Blackmon wrote:
> I have a large list of matrices and a vector that identifies the desired
> matrices that I would like to rbind. However, I am
Not sure if this what you wanted.
do.call(rbind,(matrix.list[desired.matrices]))
# [,1] [,2] [,3]
#[1,] 1 4 7
#[2,] 2 5 8
#[3,] 3 6 9
#[4,] 19 22 25
#[5,] 20 23 26
#[6,] 21 24 27
A.K.
From: Heath Blackmon
To: r-
On Thu, Jan 31, 2013 at 3:55 PM, Rich Shepard wrote:
> I don't see what's missing in my statements to add rows to a data frame
> and someone else will probably see what needs to be added to the statements.
>
> The data frame has this structure (without any data):
>
> $ PHYLUM : chr
> $
On Thu, 31 Jan 2013, Rich Shepard wrote:
I don't see what's missing in my statements to add rows to a data frame
and someone else will probably see what needs to be added to the statements.
Found the problem: a FUBAR'd R session.
Rich
__
R-hel
What version of R are you using?
I am using version 2.15.1.
Suddenly everything works correctly too. I guess a restarting R did the
trick.
On 01/02/2013 10:25 PM, David L Carlson wrote:
What version of R are you using?
I cannot replicate your results with R 2.15.2:
df1 <- data.frame()
df2
What version of R are you using?
I cannot replicate your results with R 2.15.2:
> df1 <- data.frame()
> df2 <- data.frame(foo=c(1, 2), bar=c("a", "b"))
> rbind(df1, df2)
foo bar
1 1 a
2 2 b
> df1 <- data.frame(matrix(0, 0, 2))
> names(df1) <- names(df2)
> rbind(df1, df2)
foo bar
1 1
You are a GENIUS !!
I don't know how to thank you !!
Thank you so much !
I really need to improve my R language (I take any advice)
If i can do something for you about MGARCH models, let me know
Thx again
Bilel
Le Aug 22, 2012 à 8:55 PM, Rui Barradas [via R] a écrit :
> Hello,
>
> I'm being
Hello,
I'm being lazy, but the following works.
r = 3 ; set.seed(1)
v <- matrix(c(rnorm(40)),10,4)
result <- vector("list", r*ncol(v))
ires <- 0
for (j in 1:4){
for (i in 1:r){
x <- t(v[,j]^(i)*v[,1:4]^((r-(4-1)):r))
#print(x)
ires <- ires + 1
result[[ ires
On Tue, May 1, 2012 at 2:12 PM, Nick Switanek wrote:
> Thank you, Sarah!
>
> Yes, unlist() looks like it will do just what I need. Thank you.
>
> I took a different tack. I'd changed the function returning A to coerce the
> row from the data.frame using as.numeric(). Any reason to prefer your way
Thank you, Sarah!
Yes, unlist() looks like it will do just what I need. Thank you.
I took a different tack. I'd changed the function returning A to coerce the
row from the data.frame using as.numeric(). Any reason to prefer your way
or mine?
thanks again,
Nick
On Tue, May 1, 2012 at 2:08 PM, S
Hi Nick,
On Tue, May 1, 2012 at 1:56 PM, Nick Switanek wrote:
> Thank you, Steve and Sarah, for your swift replies.
>
> I didn't know about dput(). class() returns "matrix" for A, B, and C, but
> here:
>
>> class(A)
> [1] "matrix"
>> class(B)
> [1] "matrix"
>> dput(A)
> structure(list(1239814462,
Thank you, Steve and Sarah, for your swift replies.
I didn't know about dput(). class() returns "matrix" for A, B, and C, but
here:
> class(A)
[1] "matrix"
> class(B)
[1] "matrix"
> dput(A)
structure(list(1239814462, 1239814601, 14349, 3, 4, 0, 12, 46601,
17801, 12401, 106001), .Dim = c(1L, 1
Hi,
On Tue, May 1, 2012 at 11:52 AM, Nick Switanek wrote:
> Good morning,
>
> I'm running into trouble rbind-ing numeric matrices with differing numbers
> of rows. In particular, there seem to be issues whenever a one-row numeric
> matrix is involved.
>
> Assume A is a numeric matrix with 1 row a
Hi Nick,
We absolutely need a reproducible example, with code and data, to be
able to help you.
Because otherwise I can't replicate your problem:
> A <- matrix(1:5, nrow=1, ncol=5)
> B <- matrix(6:20, nrow=3, ncol=5)
> C <- rbind(A, B)
> A
[,1] [,2] [,3] [,4] [,5]
[1,]1234
As Sarah said, you have a path problem.
Are you saying that RawData is a sub-folder (sub-directory) of
SampleProject?
And you are running the script with the working directory set to
SampleProject?
[check using getwd() as Sarah suggested]
If so, it looks like it would work if you use './RawData/F
Hi Fred,
It seems you don't have an rbind() problem, but a path problem. The
error you're getting means R can't find your file.
When specifying a relative path, as you do with "../RawData/File1.csv"
it's relative to your current working directory, not necessarily the
directory where your script i
50
> Aan: Anthony Ching Ho Ng
> CC: r-help@r-project.org
> Onderwerp: Re: [R] rbind/cbind
>
>
> On Aug 10, 2011, at 9:08 AM, Anthony Ching Ho Ng wrote:
>
> > Dear list,
> >
> > I wonder if there a better way to have rbind/cbind/append to create
> > the firs
On Aug 10, 2011, at 9:08 AM, Anthony Ching Ho Ng wrote:
Dear list,
I wonder if there a better way to have rbind/cbind/append to create
the first element (if it is empty) instead of doing the following in a
loop?
for (i in 1:10) {
if (i == 1) {
aRow = SomeExpression(i)
} else {
aRow =
Hi all,
Thanks for your responses. The merge output works for the test case as Bill
pointed out, but is contingent on non-overlapping values. Thanks for
pointing this out Ian. My actual dataset needs to allow for overlapping
values (sorry for the poor test case) so I will cook up something like
That approach relies on df1 and df2 not having overlapping values in b.
Slight variation in df2 gives different results:
> df1 <- data.frame(a=c("A","A"),b=c("B","B"))
> df2 <- data.frame(b=c("B","B"),c=c("c","c"))
> merge(df1,df2,all=TRUE)
b a c
1 B A c
2 B A c
3 B A c
4 B A c
On 5/15/11 11:1
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Jonathan Flowers
> Sent: Sunday, May 15, 2011 5:41 PM
> To: r-help@r-project.org
> Subject: [R] rbind with partially overlapping column names
>
> Hello,
>
> I would like to mer
Hi:
Another way, with a little less typing but using the same principle, is
df1$c <- df2$a <- NA
rbind(df1, df2)
Dennis
On Sun, May 15, 2011 at 5:50 PM, Ian Gow wrote:
> Hi:
>
> This is a bit of a kluge, but works for your test case:
>
>> df2[,setdiff(names(df1),names(df2))] <- NA
>> df1[,setd
Hi:
This is a bit of a kluge, but works for your test case:
> df2[,setdiff(names(df1),names(df2))] <- NA
> df1[,setdiff(names(df2),names(df1))] <- NA
> df3 <- rbind(df1,df2)
> df3
a b c
1 A B
2 A B
3 b c
4 b c
-Ian
On 5/15/11 7:41 PM, "Jonathan Flowers" wrote:
>Hello,
>
>I would like to
You need a list object indeed of a vector, try this:
rbind(df, dreps = c(rep(list(TRUE), 7), 5, 0))
On Tue, Mar 22, 2011 at 10:12 PM, Alexy Khrabrov wrote:
> I have a dataframe with many rows like this:
>
>> df
> X1 X2 X3 X4 X5 X6 X7 week d
> sim1 FALSE TRUE T
On Oct 14, 2010, at 10:40 AM, David Winsemius wrote:
On Oct 14, 2010, at 10:31 AM, Maas James Dr (MED) wrote:
Sorry for the verbose example. I want to row bind two matrices,
and all works except I want the column labelled "row" to be
sequential in the new matrix, shown as "mat3" here, i.
On Oct 14, 2010, at 10:31 AM, Maas James Dr (MED) wrote:
Sorry for the verbose example. I want to row bind two matrices, and
all works except I want the column labelled "row" to be sequential
in the new matrix, shown as "mat3" here, i.e. needs to be 1:6 and
not 1:3 repeated twice. Any su
Also, when I create the data.frame with matrix and try to rbind, I get
warnings..
Warning messages:
1: In `[<-.factor`(`*tmp*`, ri, value = "4") :
invalid factor level, NAs generated
2: In `[<-.factor`(`*tmp*`, ri, value = "5") :
invalid factor level, NAs generated
3: In `[<-.factor`(`*tmp*`, r
But If I do that how will I resize later?
On Mon, Sep 6, 2010 at 8:54 PM, ONKELINX, Thierry
wrote:
> This will give a matrix with 0 rows.
>
> data.frame(matrix(nrow = 0, ncol = 22, dimnames = list(NULL,
> LETTERS[1:22])))
>
> But you should avoid growing dataframes is the final dataframe is goin
This will give a matrix with 0 rows.
data.frame(matrix(nrow = 0, ncol = 22, dimnames = list(NULL,
LETTERS[1:22])))
But you should avoid growing dataframes is the final dataframe is going
to be large. You are very likely to get memory problems. It is much to
better to create a large enough datafr
Hi again!
I'm trying to follow your general goal from your questions today but
it's not easy.
First, declaring a data.frame of 0 rows is a bad idea. It is much faster
to define the length and number of rows from the beginning and to fill
it then.
Second, I don't know how to do it! What I kn
Works wonderfully. I am very happy that I eventually found this post :)
Daniel.
--
View this message in context:
http://r.789695.n4.nabble.com/rbind-with-different-columns-tp907370p2263588.html
Sent from the R help mailing list archive at Nabble.com.
___
a hah,
that works :)
simple but sweet,
thanks,
Rob
On Mon, Mar 15, 2010 at 1:59 PM, Henrique Dallazuanna wrote:
> Try this:
>
> do.call(rbind, lapply(list(list1, list2), as.data.frame))
>
> On Mon, Mar 15, 2010 at 3:42 PM, Rob Forler wrote:
> > Hi,
> >
> > This has bugged me for a bit. First
Try this:
do.call(rbind, lapply(list(list1, list2), as.data.frame))
On Mon, Mar 15, 2010 at 3:42 PM, Rob Forler wrote:
> Hi,
>
> This has bugged me for a bit. First question is how to keep classes with
> rbind, and second question is how to properly return vecotrs instead of
> lists after turnin
Karl Ove Hufthammer wrote:
In article <4addc1d0.2040...@yahoo.de>, niederlein-rs...@yahoo.de
says...
In every list entry is a data.frame but the columns are only partially
the same. If I have exactly the same columns, I could do the following
command to combine my data:
do.call("rbind", myLis
Nice! I was going to recommend
merge(merge(myList[[1]], myList[[2]], all=TRUE, sort=FALSE),
myList[[3]], all=TRUE, sort=FALSE)
but rbind.fill is better.
-Ista
On Tue, Oct 20, 2009 at 10:05 AM, Karl Ove Hufthammer wrote:
> In article <4addc1d0.2040...@yahoo.de>, niederlein-rs...@yahoo.de
> says
In article <4addc1d0.2040...@yahoo.de>, niederlein-rs...@yahoo.de
says...
> In every list entry is a data.frame but the columns are only partially
> the same. If I have exactly the same columns, I could do the following
> command to combine my data:
>
> do.call("rbind", myList)
>
> but of cour
> z <- abind(x[,,1], c(4,5,6),along=0)
z is probably not what you want because you aren't using the drop=FALSE
argument. See the FAQ 7.5
abind, and arrays in general, are rectangular solids. They are not
ragged. For that you need lists. To get something like your request
> x
> , , 1
>
(resent as hotmail really cannot format plaintext, but I've just read
Tony Plate's message that what I'd like to do might not be possible)
>
> library(abind) ## array binding
I've looked into using abind() but it seems I might not understand it properly.
I can build my 2 table array and insert a
Unfortunately, I can't read your examples. Can you repost without the
formatting characters which are confusing when rendered in plain text?
One thing to keep in mind is that a R array is a regular object -- e.g., if you have a 2
x 3 x 4 array, then if you want to add a row to a slice, you mus
<4adbca02.8020...@temple.edu>
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
>=20
> library(abind) ## array binding
I've looked into using abind()=2C but it seems I might not understand it pr=
operly.
I can build my 2 table arra
library(abind) ## array binding
__
R-help@r-project.org mailing list
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
On Tue, Sep 29, 2009 at 8:05 PM, David Winsemius wrote:
>
> On Sep 29, 2009, at 1:43 PM, Carlos Hernandez wrote:
>
> Dear All,
>> I´m using the following code:
>>
>> all1<-gg2[[1]][[1]]; for(i in 1:48){ all1 <- rbind(all1,gg2[[i]][[1]]) }
>>
>
> Looks to me that you would be getting a duplicate c
On Sep 29, 2009, at 1:43 PM, Carlos Hernandez wrote:
Dear All,
I´m using the following code:
all1<-gg2[[1]][[1]]; for(i in 1:48){ all1 <- rbind(all1,gg2[[i]]
[[1]]) }
Looks to me that you would be getting a duplicate copy of the first
matrix, but aside from that what problems are you expe
Thank you for your quick reply! It works perfectly!
On Tue, Sep 29, 2009 at 7:51 PM, Henrique Dallazuanna wrote:
> Try this;
>
> do.call(rbind, sapply(gg2, '[', 1))
>
> On Tue, Sep 29, 2009 at 2:43 PM, Carlos Hernandez
> wrote:
> > Dear All,
> > I´m using the following code:
> >
> > all1<-gg2[[1
Try this;
do.call(rbind, sapply(gg2, '[', 1))
On Tue, Sep 29, 2009 at 2:43 PM, Carlos Hernandez wrote:
> Dear All,
> I´m using the following code:
>
> all1<-gg2[[1]][[1]]; for(i in 1:48){ all1 <- rbind(all1,gg2[[i]][[1]]) }
>
> to create a new matrix that contains all the matrices in a list call
Now that I've actually read the question,
I'm in a better position to answer it.
I have no idea how you are getting the
results that you show, but you can use
'rownames' to set whatever row names you
like. As in:
rownames(result) <- 1:6
Pat
Patrick Burns wrote:
I'm guessing that your 'data'
I'm guessing that your 'data' and 'data1'
are just vectors so your 'rbind' command
returns a 2 by 3 matrix.
Jim showed you already that:
rbind(as.matrix(data), as.matrix(data1))
will probably get you what you are looking
for.
However, I'm suspicious that just:
c(data, data1)
will serve you j
You need to provide a reproducible example. At least provide an 'str' of
your data and preferably the output of 'dput'. I am not sure what you data
looks like.
works fine for me when using matrices:
> data
[,1]
[1,]5
[2,] 2342
[3,] 33
> data1
[,1]
[1,]6
[2,]5
[3,]7
>
Hi Mike,
MikSmith wrote:
Hi
I have a dataset of orientation and elevation in a dataframe which I am
plotting in circular. Orientation is on the range 0-360, however I need to
reduce this to 0-180 as the values over 180 are not necessarily correct. I
can do
striae$orientation[striae$orientation
Thank you, it is working.
David
2009/4/23 Henrique Dallazuanna
> Try this:
>
> lapply(names(col.prop), function(idx)rbind(col.prop[[idx]], n[[idx]]))
>
> On Thu, Apr 23, 2009 at 7:33 AM, David Hajage wrote:
>
>> I have two lists (and possibly more):
>>
>> col.prop <-
>> structure(list(B = stru
Try this:
lapply(names(col.prop), function(idx)rbind(col.prop[[idx]], n[[idx]]))
On Thu, Apr 23, 2009 at 7:33 AM, David Hajage wrote:
> I have two lists (and possibly more):
>
> col.prop <-
> structure(list(B = structure(c(0.5, 0.5, 0.6, 0.4, 0.556,
> 0.444), class = c("
Thank you very much, do.call is, of course, much more elegant!
Dimitri
On Wed, Apr 22, 2009 at 9:58 PM, jim holtman wrote:
> 'do.call' is your friend::
>
>> a<-data.frame(a=1,b=2,c=3)
>> b<-data.frame(a=c(4,7),b=c(5,8),c=c(6,9))
>> c<-data.frame(a=c(10,13,16),b=c(11,14,17),c=c(12,15,18))
>> X<-li
Replying to my own post. I found the following solution:
full.frame<-as.data.frame(matrix(nrow=0,ncol=3))
names(full.frame)<-c("a","b","c")
for(j in 1:length(X)) {full.frame<-rbind(full.frame,X[[j]])}
(full.frame)
Is there a more elegant solution?
Thank you!
Dimitri
On Wed, Apr 22, 2009 at 9:36
'do.call' is your friend::
> a<-data.frame(a=1,b=2,c=3)
> b<-data.frame(a=c(4,7),b=c(5,8),c=c(6,9))
> c<-data.frame(a=c(10,13,16),b=c(11,14,17),c=c(12,15,18))
> X<-list()
> X[[1]]<-a
> X[[2]]<-b
> X[[3]]<-c
> do.call(rbind, X)
a b c
1 1 2 3
2 4 5 6
3 7 8 9
4 10 11 12
5 13 14 15
6 16
?do.call
... as in do.call(rbind,X)
(A very useful and powerful feature os the S language: Computing on the
language. See V&R's "S Programming" for an informative discussion (there may
well be others, of course).
-- Bert
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-h
On Apr 22, 2009, at 8:36 PM, Dimitri Liakhovitski wrote:
Hello everyone!
I have a list X with 3 elements, each of which is a data frame, for
example:
a<-data.frame(a=1,b=2,c=3)
b<-data.frame(a=c(4,7),b=c(5,8),c=c(6,9))
c<-data.frame(a=c(10,13,16),b=c(11,14,17),c=c(12,15,18))
X<-list()
X[[1
You could 'split' the dataframe and then write out each element: something like
x <- split(data.info, data.info$station.id)
for (i in names(x)) write.csv(x[[i]], file=paste(i, ".csv", sep=""))
On Tue, Feb 17, 2009 at 10:11 PM, CJ Rubio wrote:
>
> it works perfectly thank you for your help...
it works perfectly thank you for your help
what if i want to seperate each stations data and save in a .csv file??
while i'm asking you these i'm also finding some ways to do so..
thank you again.
jholtman wrote:
>
> try using:
>
> data.info <- rbind(data.info, cbind(station.id, y
try using:
data.info <- rbind(data.info, cbind(station.id, year, date, max.discharge))
On Tue, Feb 17, 2009 at 9:26 PM, CJ Rubio wrote:
>
> i have the following constructed and running very well,, thanks to Gabor
> Grothendieck for his help.
>
>>data.info <- c("station.id", "year", "date", "max.
For matrices you can use kronecker:
> kronecker(rep(1, 6), data.matrix(Xdf))
[,1] [,2] [,3] [,4]
[1,] 1.1 2.1 3.1 4.1
[2,] 1.2 2.2 3.2 4.2
[3,] 1.1 2.1 3.1 4.1
[4,] 1.2 2.2 3.2 4.2
[5,] 1.1 2.1 3.1 4.1
[6,] 1.2 2.2 3.2 4.2
[7,] 1.1 2.1 3.1 4.1
[8,] 1.2 2
Ben Bolker wrote:
Dimitris Rizopoulos erasmusmc.nl> writes:
you can use indexing, e.g.,
mat <- matrix(rnorm(20), 4, 5)
mat
mat[rep(1:nrow(mat), 3), ]
I hope it helps.
Best,
Dimitris
or matrix trickery:
z <- as.data.frame(matrix(sample(1:9,20,replace=TRUE),nrow=4))
matrix(rep(a
On 07-Jan-09 15:22:57, Niccolò Bassani wrote:
> Dear R users,I'm facing a trivial problem, but I really can't solve it.
> I've tried a dozen of codes, but I can't get the result I want.
> The question is: I have a dataframe like this one
>
> [,1] [,2] [,3] [,4] [,5]
> [1,]12345
On Wed, 2009-01-07 at 16:22 +0100, Niccolò Bassani wrote:
> Dear R users,I'm facing a trivial problem, but I really can't solve it. I've
> tried a dozen of codes, but I can't get the result I want.
> The question is: I have a dataframe like this one
>
> [,1] [,2] [,3] [,4] [,5]
> [1,]12
Dimitris Rizopoulos erasmusmc.nl> writes:
>
> you can use indexing, e.g.,
>
> mat <- matrix(rnorm(20), 4, 5)
>
> mat
> mat[rep(1:nrow(mat), 3), ]
>
> I hope it helps.
>
> Best,
> Dimitris
or matrix trickery:
z <- as.data.frame(matrix(sample(1:9,20,replace=TRUE),nrow=4))
matrix(rep(as.mat
Try this:
m[rep(seq_len(nrow(m)), 3),]
On Wed, Jan 7, 2009 at 1:22 PM, Niccolò Bassani wrote:
> Dear R users,I'm facing a trivial problem, but I really can't solve it.
> I've
> tried a dozen of codes, but I can't get the result I want.
> The question is: I have a dataframe like this one
>
> [,1]
you can use indexing, e.g.,
mat <- matrix(rnorm(20), 4, 5)
mat
mat[rep(1:nrow(mat), 3), ]
I hope it helps.
Best,
Dimitris
Niccolò Bassani wrote:
Dear R users,I'm facing a trivial problem, but I really can't solve it. I've
tried a dozen of codes, but I can't get the result I want.
The quest
Hi array (?),
Hi, I would like to rbind 2 data frames. They both some common column names,
but also some unique column names each, is there any simple function that rbind
these 2 data frames with filling NAs for those columns of unique names?
You can use the reshape package by Hadley Wickham
TED] [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, December 26, 2007 1:37 PM
To: r-help@r-project.org; Kondamani, Arjun (GMI - NY Corporate Bonds)
Subject: Re: [R] Rbind-ing a list into one item
>From: "Kondamani, Arjun (GMI - NY Corporate Bonds)"
<[EMA
Hi Arjun,
try do.call()
Cheers
Andrew
On Wed, Dec 26, 2007 at 04:23:51PM -0500, Kondamani, Arjun (GMI - NY Corporate
Bonds) wrote:
> Hi,
>
> I am doing the following:
>
> 1. I have a list of files.. Files1=list.files("some
> directory",pattern="some pattern")
> 2. I define a list as res=vec
>From: "Kondamani, Arjun (GMI - NY Corporate Bonds)" <[EMAIL PROTECTED]>
>Date: 2007/12/26 Wed PM 03:23:51 CST
>To: r-help@r-project.org
>Subject: [R] Rbind-ing a list into one item
try do.call(rbind,res)
>Hi,
>
>I am doing the following:
>
>1. I have a list of files.. Files1=list.files("some
>d
88 matches
Mail list logo