Hi all, A simple question which I don???t seem to be able to solve: I want to make a data.frame of 360 rows and 94228 column with only zero???s without having to type all these zero???s ;-) What is the easiest method? Thanks, Naomi Disclaimer: De informatie opgenomen in dit bericht (en bijlagen) kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde(n). Indien u dit bericht ten onrechte ontvangt, wordt u geacht de inhoud niet te gebruiken, de afzender direct te informeren en het bericht te vernietigen. Aan dit bericht kunnen geen rechten of plichten worden ontleend. ---------------------------------------------------------------------------- ---------------------------- Disclaimer: The information contained in this message may be confidential and is intended to be exclusively for the addressee. Should you receive this message unintentionally, you are expected not to use the contents herein, to notify the sender immediately and to destroy the message. No rights can be derived from this message.
well, you can first create a matrix and then turn into a data frame, e.g., mat <- matrix(0, 5, 10) as.data.frame(mat) I hope it helps. Best, Dimitris Duijvesteijn, Naomi wrote:> Hi all, > > > A simple question which I don???t seem to be able to solve: > > > I want to make a data.frame of 360 rows and 94228 column with only zero???s > without having to type all these zero???s ;-) > > > What is the easiest method? > > > Thanks, > > Naomi > > > > > Disclaimer: De informatie opgenomen in dit bericht (en bijlagen) kan > vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde(n). > Indien u dit bericht ten onrechte ontvangt, wordt u geacht de inhoud niet te > gebruiken, de afzender direct te informeren en het bericht te vernietigen. > Aan dit bericht kunnen geen rechten of plichten worden ontleend. > > ---------------------------------------------------------------------------- > ---------------------------- > > Disclaimer: The information contained in this message may be confidential > and is intended to be exclusively for the addressee. Should you receive this > message unintentionally, you are expected not to use the contents herein, to > notify the sender immediately and to destroy the message. No rights can be > derived from this message. > > > ------------------------------------------------------------------------ > > ______________________________________________ > R-help at 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 code.-- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014
Dear R-people I have a question concerning plotting graphs. Here an example dataset a<-c(1,2,3,4,5,6) b<-c(3,5,4,6,1,1) c<-c(1,1,1,1,1,1) d<-as.data.frame(cbind(a,b,c)) plot.new() plot(d$a, d$b, col="red") par(new=TRUE) plot(d$a,d$c, col="red", pch="|") What I would want is to plot de second plot under the first plot. So not in the the first plot. There is a way to divide your graph in 2 or 3 parts and use the same x-axis but I do not seem to get it right. Could somebody help me out? Thanks in advance! Regards, Naomi Disclaimer: De informatie opgenomen in dit bericht (en bijlagen) kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde(n). Indien u dit bericht ten onrechte ontvangt, wordt u geacht de inhoud niet te gebruiken, de afzender direct te informeren en het bericht te vernietigen. Aan dit bericht kunnen geen rechten of plichten worden ontleend. ------------------------------------------------------------------------------------------------------------------------------------------ Disclaimer: The information contained in this message may be confidential and is intended to be exclusively for the addressee. Should you receive this message unintentionally, you are expected not to use the contents herein, to notify the sender immediately and to destroy the message. No rights can be derived from this message. Please consider the environment before printing this email
On 10/16/2009 09:22 PM, Duijvesteijn, Naomi wrote:> Dear R-people > > I have a question concerning plotting graphs. > Here an example dataset > > > a<-c(1,2,3,4,5,6) > b<-c(3,5,4,6,1,1) > c<-c(1,1,1,1,1,1) > d<-as.data.frame(cbind(a,b,c)) > plot.new() > plot(d$a, d$b, col="red") > par(new=TRUE) > plot(d$a,d$c, col="red", pch="|") > > What I would want is to plot de second plot under the first plot. So not in the the first plot. There is a way to divide your graph in 2 or 3 parts and use the same x-axis but I do not seem to get it right. Could somebody help me out? >Hi Naomi, Try this: par(mfrow=c(2,1)) plot(d$a,d$b,col="red") plot(d$a,d$c,col="red",pch="|") You may want to change the margins (par(mar=c(...)) to get the spacing the way you want it. Jim
On Fri, Oct 16, 2009 at 12:22:06PM +0200, Duijvesteijn, Naomi wrote:> I have a question concerning plotting graphs. > Here an example dataset > > > a<-c(1,2,3,4,5,6) > b<-c(3,5,4,6,1,1) > c<-c(1,1,1,1,1,1) > d<-as.data.frame(cbind(a,b,c)) > plot.new() > plot(d$a, d$b, col="red") > par(new=TRUE) > plot(d$a,d$c, col="red", pch="|") > > What I would want is to plot de second plot under the first plot. So > not in the the first plot. There is a way to divide your graph in 2 > or 3 parts and use the same x-axis but I do not seem to get it > right. Could somebody help me out?Yes, use something alng these lines: par(mrfow=c(2,1)) plot(d$a, d$b, col="red") plot(d$a, d$c, col="red", pch="|") As both plots use the same data for X you are set. If you need to force two datasets with different x-ranges into the same range, you can use the xlim parameter to define the desired range. cu Philipp -- Dr. Philipp Pagel Lehrstuhl f?r Genomorientierte Bioinformatik Technische Universit?t M?nchen Wissenschaftszentrum Weihenstephan Freising, Germany http://webclu.bio.wzw.tum.de/~pagel/
You can use ggplot2. library(ggplot2) a<-c(1,2,3,4,5,6) b<-c(3,5,4,6,1,1) c<-c(1,1,1,1,1,1) dframe = data.frame(a,b,c);dframe melt.dframe <- melt(dframe, id= "a");melt.dframe qplot(a,value,data=melt.dframe) + facet_grid(variable~.,scales="free") Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA --- On Fri, 10/16/09, Duijvesteijn, Naomi <Naomi.Duijvesteijn at ipg.nl> wrote:> From: Duijvesteijn, Naomi <Naomi.Duijvesteijn at ipg.nl> > Subject: [R] two graphs 1 x-axis > To: "r-help at r-project.org" <r-help at r-project.org> > Date: Friday, October 16, 2009, 3:22 AM > > Dear R-people > > I have a question concerning plotting graphs. > Here an example dataset > > > a<-c(1,2,3,4,5,6) > b<-c(3,5,4,6,1,1) > c<-c(1,1,1,1,1,1) > d<-as.data.frame(cbind(a,b,c)) > plot.new() > plot(d$a, d$b, col="red") > par(new=TRUE) > plot(d$a,d$c, col="red", pch="|") > > What I would want is to plot de second plot under the first > plot. So not in the the first plot. There is a way to divide > your graph in 2 or 3 parts and use the same x-axis but I do > not seem to get it right. Could somebody help me out? > > Thanks in advance! > > Regards, > Naomi > > > > > > > Disclaimer: De informatie opgenomen in dit bericht (en > bijlagen) kan vertrouwelijk zijn en is uitsluitend bestemd > voor de geadresseerde(n). Indien u dit bericht ten onrechte > ontvangt, wordt u geacht de inhoud niet te gebruiken, de > afzender direct te informeren en het bericht te vernietigen. > Aan dit bericht kunnen geen rechten of plichten worden > ontleend. > > ------------------------------------------------------------------------------------------------------------------------------------------ > > Disclaimer: The information contained in this message may > be confidential and is intended to be exclusively for the > addressee. Should you receive this message unintentionally, > you are expected not to use the contents herein, to notify > the sender immediately and to destroy the message. No rights > can be derived from this message. > > Please consider the environment before printing this email > > > -----Inline Attachment Follows----- > > ______________________________________________ > R-help at 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 code. >