| To: | "Krishnamachari, Raghuraman" <Raghu.Krishnamachari@leggmasonasia.com.sg> |
|---|---|
| Subject: | Re: plot histogram of a distribution |
| From: | David L Lorenz <lorenz@usgs.gov> |
| Date: | Thu, 24 Aug 2006 07:32:42 -0500 |
| Cc: | s-news@lists.biostat.wustl.edu, s-news-owner@lists.biostat.wustl.edu |
| In-reply-to: | <46FE375EF87BAC42B69E493F296F4ACC02D13ED1@singx01.wam.westernasset.local> |
|
Raghu, If you look at the formula in your for loop, you will see that it has exactly the same appearance as the one that works. That means the routines that evaluate the formula see the same thing and are looking at a column named f.name in the data set and not a column named FCF. You know that f.name is a variable that represents that column, but the routine that evaluates the formula does not. For cases like this, you can use the as.formula() function. Try this: histogram(as.formula(paste("~", f.name, "| Country")), data="" = 10,type="count") I do not see where Country comes from if you select only the column f.name from data! Dave
Dear all, I am new to this list and splus. I am trying to plot a histogram of a distribution using "histogram". The issue is i am unable to call this in a loop with different Factors variables. > factor.names [1] "Tobin.Q" "EBITDA" "FCF" > factor.cols [1] "Tobin.Q" "EBITDA" "FCF" ================================= for(i in 1:length(factor.cols)) { f.name<-factor.names[i] histogram(~ f.name | Country, data="" = 10,type="count") } ==================================== when i replace f.name with the numeric column names like FCF,EBITDA individually, the above function works. But how to pass these values in a loop. histogram(~ FCF | Country, data="" = 10,type="count") -- works whereas histogram(~ "FCF" | Country, data="" = 10,type="count") -- gives different results. Hope someone throw light on this. thanks, Raghu. ********************************************************************** E-mail sent through the Internet is not secure. Legg Mason Asset Management (Asia) Pte Ltd [Co. Reg. No. 200007692R] therefore recommends that you do not utilize electronic mail to send to us any confidential or sensitive information, including account numbers and personal identification numbers. Delivery, and/or timely delivery of Internet electronic mail is not guaranteed. Legg Mason Asset Management (Asia) Pte Ltd therefore recommends that you do not send time-sensitive or action-oriented messages to us via electronic mail. ********************************************************************** |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: calculating upper and lower CL using lme and glme, Spencer Graves |
|---|---|
| Next by Date: | Re: plot histogram of a distribution, Krishnamachari, Raghuraman |
| Previous by Thread: | plot histogram of a distribution, Krishnamachari, Raghuraman |
| Next by Thread: | Re: plot histogram of a distribution, Krishnamachari, Raghuraman |
| Indexes: | [Date] [Thread] [Top] [All Lists] |