[R] X-axis labels in histograms drawn by the truehist function
Hi, I had sent this email last week, but received no reply. So, I am resending it - please excuse me for the redundant email. I have a simple problem that I would appreciate getting some tips. I am using the truehist function within an apply call to plot multiple histograms. I can't figure out how to get truehist to use the column names of the matrix as the labels for the x-axis of the histograms. Here is a simple example: library(MASS) # this contains the truehist function X - matrix(runif(4000),ncol=4) colnames(X) - c(X1,X2,X3,X4) par(mfrow=c(2,2)) apply(X, 2, function(x)truehist(x)) In this example, I would like the x-labels of the histograms to be X1, X2, etc. Any help is appreciated. Best, Ravi --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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.
Re: [R] X-axis labels in histograms drawn by the truehist function
On Mon, 2006-10-02 at 14:58 -0400, Ravi Varadhan wrote: Hi, I had sent this email last week, but received no reply. So, I am resending it - please excuse me for the redundant email. I have a simple problem that I would appreciate getting some tips. I am using the truehist function within an apply call to plot multiple histograms. I can't figure out how to get truehist to use the column names of the matrix as the labels for the x-axis of the histograms. Here is a simple example: library(MASS) # this contains the truehist function X - matrix(runif(4000),ncol=4) colnames(X) - c(X1,X2,X3,X4) par(mfrow=c(2,2)) apply(X, 2, function(x)truehist(x)) In this example, I would like the x-labels of the histograms to be X1, X2, etc. Any help is appreciated. Best, Ravi Ravi, Gabor did reply: https://stat.ethz.ch/pipermail/r-help/2006-September/114019.html HTH, Marc Schwartz __ R-help@stat.math.ethz.ch 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.
Re: [R] X-axis labels in histograms drawn by the truehist function
Thank you, Marc and Gabor. I apologize for having missed Gabor's reply. Best regards, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: Marc Schwartz (via MN) [mailto:[EMAIL PROTECTED] Sent: Monday, October 02, 2006 3:25 PM To: Ravi Varadhan Cc: r-help@stat.math.ethz.ch Subject: Re: [R] X-axis labels in histograms drawn by the truehist function On Mon, 2006-10-02 at 14:58 -0400, Ravi Varadhan wrote: Hi, I had sent this email last week, but received no reply. So, I am resending it - please excuse me for the redundant email. I have a simple problem that I would appreciate getting some tips. I am using the truehist function within an apply call to plot multiple histograms. I can't figure out how to get truehist to use the column names of the matrix as the labels for the x-axis of the histograms. Here is a simple example: library(MASS) # this contains the truehist function X - matrix(runif(4000),ncol=4) colnames(X) - c(X1,X2,X3,X4) par(mfrow=c(2,2)) apply(X, 2, function(x)truehist(x)) In this example, I would like the x-labels of the histograms to be X1, X2, etc. Any help is appreciated. Best, Ravi Ravi, Gabor did reply: https://stat.ethz.ch/pipermail/r-help/2006-September/114019.html HTH, Marc Schwartz __ R-help@stat.math.ethz.ch 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.
[R] X-axis labels in histograms drawn by the truehist function
Hi, I have a simple problem that I would appreciate getting some tips. I am using the truehist function within an apply call to plot multiple histograms. I can't figure out how to get truehist to use the column names of the matrix as the labels for the x-axis of the histograms. Here is a simple example: X - matrix(runif(4000),ncol=4) colnames(X) - c(X1,X2,X3,X4) par(mfrow=c(2,2)) apply(X, 2, function(x)truehist(x)) In this example, I would like the x-labels of the histograms to be X1, X2, etc. Any help is appreciated. Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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.
Re: [R] X-axis labels in histograms drawn by the truehist function
Try this: f - function(x,xlab) truehist(x, xlab = xlab) mapply(f, as.data.frame(X), colnames(X)) On 9/29/06, Ravi Varadhan [EMAIL PROTECTED] wrote: Hi, I have a simple problem that I would appreciate getting some tips. I am using the truehist function within an apply call to plot multiple histograms. I can't figure out how to get truehist to use the column names of the matrix as the labels for the x-axis of the histograms. Here is a simple example: X - matrix(runif(4000),ncol=4) colnames(X) - c(X1,X2,X3,X4) par(mfrow=c(2,2)) apply(X, 2, function(x)truehist(x)) In this example, I would like the x-labels of the histograms to be X1, X2, etc. Any help is appreciated. Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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. __ R-help@stat.math.ethz.ch 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.