Dear R users:
> append(1:5, 0:1, after=2)
[1] 1 2 0 1 3 4 5
If I want to repeat the appended value every 2 like the following:
[1] 1 2 0 1 3 4 0 1 5
How should I modify?
Thank you for any help.
__
R-help@stat.math.ethz.ch mailing list
https://stat.et
Here is a way:
x <- 1:10
mySeq <- c(42,42)
byTwo <- rep(seq(length(x) + 1), each=2)[1:length(x)]
y <- lapply(split(x, byTwo), function(a){
c(a, mySeq)
})
unlist(y)
On 12/10/05, Judy Chung <[EMAIL PROTECTED]> wrote:
>
> Dear R users:
>
> > append(1:5, 0:1, after=2)
> [1] 1 2 0 1 3 4 5
>
> If I
append does not take a vector the after= argument. Its
probably easiest to just use a loop:
x <- 1:5
for(i in c(4,2)) x <- append(x, 0:1, after = i)
Note that they need to be inserted in reverse order.
On 12/10/05, Judy Chung <[EMAIL PROTECTED]> wrote:
> Dear R users:
>
> > append(1:5, 0:1, a
R Help:
I have read a number of tables into R with identical headings and I
would now like to make a single table that has all the data appended
under this single heading line.
for example:
t1 <- read.csv("f1",header=TRUE)
t2 <- read.csv("f2",header=TRUE)
all <- c(t1,t2)
#all is now twice
Dear all,
Can I use "write.table" to append columnns?
Thanks for any help
-MY
[[alternative HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://ww
?rbind
Bill Hunsicker wrote:
>R Help:
>
>I have read a number of tables into R with identical headings and I
>would now like to make a single table that has all the data appended
>under this single heading line.
>
>for example:
>
>t1 <- read.csv("f1",header=TRUE)
>t2 <- read.csv("f2",header=T
Does rbind() do what you want?
At 11:47 AM -0500 12/14/05, Bill Hunsicker wrote:
>R Help:
>
>I have read a number of tables into R with identical headings and I
>would now like to make a single table that has all the data appended
>under this single heading line.
>
>for example:
>
>t1 <- read.csv(
Using append=TRUE in write.table only appends rows (see example below).
You might be interested in a recent tread about appending to save()
http://tolstoy.newcastle.edu.au/R/help/04/07/1467.html
> write.table( matrix(1:9, 3), file="aaa.txt", sep="\t" )
> write.table( matrix(101:109, 3), file="aaa