[R] Bind field of a list

Colin.Umansky at barclayscapital.com Colin.Umansky at barclayscapital.com
Fri Feb 19 15:37:18 CET 2010


Hello, 
Thank you but I think not what I would like to get as an answer is the list ("x","v","n","m") + what you gave me could work for 2 fields but if I have 200...


What I want is a vectorize way to do 
bindlists <- function(x){
	output = c();
	for (i in 1:length(x))
	{
		output = c(output,x[[i]])
	}
return(output)
}

Regards

-----Original Message-----
From: Philipp Rappold [mailto:philipp.rappold at gmail.com] 
Sent: 19 February 2010 14:31
To: Umansky, Colin: EDG (LDN)
Cc: r-help at r-project.org
Subject: Re: [R] Bind field of a list

is this what you're looking for?

test <- data.frame(a=c("x","v"),b=c("n","m"))
test

statquant wrote:
> Hello all
> I am new in R and so easy stuff are difficult...
> let say that I have a list 
> test <- list(a=c("x","v"),b=c("n","m"))
> how can I without a loop get test$a bind with test$b (obviously in real life
> their would be many fields)
> 
> Cheers and thanks
_______________________________________________

This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing.  Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP.  This email may relate to or be sent from other members of the Barclays Group.



More information about the R-help mailing list