One thing you might do is to transform the data into a format that is
easier to combine; I like using 'merge':
> mynames=cbind(c('a','b'),c(11,22))
> lst=list(a=c(1,2), b=5)
> mynames
[,1] [,2]
[1,] "a" "11"
[2,] "b" "22"
> lst
$a
[1] 1 2
$b
[1] 5
> mynames.df <- as.data.frame(mynames)
>
Try this:
cbind(mynames[rep(seq(nrow(mynames)), sapply(lst, length)),], unlist(lst))
On Mon, Jun 14, 2010 at 9:06 AM, Yuan Jian wrote:
> Hello,
>
> I could not find a clear solution for the follow question. please allow me
> to ask. thanks
>
> mynames=cbind(c('a','b'),c(11,22))
> lst=list(a=c(1
Hello,
I could not find a clear solution for the follow question. please allow me
to ask. thanks
mynames=cbind(c('a','b'),c(11,22))
lst=list(a=c(1,2), b=5)
now I try to combine mynames and lst:
a 1 11
a 2 11
b 5 22
thanks
jian
[[alternative HTML version deleted]]
On 10/7/07, Adrian Dusa <[EMAIL PROTECTED]> wrote:
> On Sunday 07 October 2007, Gabor Grothendieck wrote:
> > I thought the latest zoo fixes were on CRAN but perhaps they
> > are not. Try this:
> >
> > library(zoo)
> > # next line loads latest version of merge.zoo (fixed in August)
> > source("ht
On Sunday 07 October 2007, Gabor Grothendieck wrote:
> I thought the latest zoo fixes were on CRAN but perhaps they
> are not. Try this:
>
> library(zoo)
> # next line loads latest version of merge.zoo (fixed in August)
> source("http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/
I thought the latest zoo fixes were on CRAN but perhaps they
are not. Try this:
library(zoo)
# next line loads latest version of merge.zoo (fixed in August)
source("http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/R/merge.zoo.R?rev=361&root=zoo";)
as.vector(time(do.call(me
On Sunday 07 October 2007, you wrote:
> Perhaps its a version problem? [...]
>
> > R.version.string # Vista
>
> [1] "R version 2.6.0 beta (2007-09-23 r42958)"
>
> > packageDescription("zoo")$Version
>
> [1] "1.3-2"
I don't know, everything is up to date here, too.
I'm using Kubuntu Linux and the
Perhaps its a version problem? Here is what I get:
> aa <- list(one=c("o", "n", "e"),
+ tea=c("t", "e", "a"),
+ thre=c("t", "h", "r", "e"))
> library(zoo)
> as.vector(time(do.call(merge, c(lapply(aa, function(x) zoo(,x)), all =
> FALSE
[1] "e"
>
> R.version.string
On Sunday 07 October 2007, Gabor Grothendieck wrote:
> zoo's merge can do a multiway intersection. We turn each component
> of aa into the times of a dataless zoo object (assuming the elements of
> each component are unique) and merge them together using all = FALSE
> which will only leave those p
zoo's merge can do a multiway intersection. We turn each component
of aa into the times of a dataless zoo object (assuming the elements of
each component are unique) and merge them together using all = FALSE
which will only leave those points at times in all components. Extracting
the time and st
On Saturday 06 October 2007, Marc Schwartz wrote:
> [...]
>
> intersectList <- function(x)
> {
> res <- table(unlist(sapply(x, unique)))
> names(res[res == length(x)])
> }
>
>
> In the first line, I use unique() to ensure that if the same letter
> appears more than once in the same list element
On Sat, 2007-10-06 at 19:49 +, Adrian Dusa wrote:
> Dear list,
>
> Given a list of elements like:
> aa <- list(one=c("o", "n", "e"),
>tea=c("t", "e", "a"),
>thre=c("t", "h", "r", "e"))
>
> Is there a function that returns the intersection between all?
> Both ma
Dear list,
Given a list of elements like:
aa <- list(one=c("o", "n", "e"),
tea=c("t", "e", "a"),
thre=c("t", "h", "r", "e"))
Is there a function that returns the intersection between all?
Both match() and intersect() only deal with two arguments, but sometimes I
ha
13 matches
Mail list logo