anjalishitole at yahoo.co.in
2007-Sep-27 11:22 UTC
[Rd] to overcome error while computing sd for each subset of data (PR#9931)
Full_Name: Anjali Shitole Version: R 2.5.1 OS: Submission from: (NULL) (202.141.157.91) I want to compute coefficient of variation for each subset of data. Each subset is heterogeneous means number of rows in each subset are different.These all subsets are in one dataset situated one by one. i have used aggregate command to calculate mean for each subset. But same command for calculating sd gives error see the following program,> a<-read.table("c:/mri/data/ratioinput.txt",header=T, na.strings "NA",fill=TRUE) > dim(a)[1] 32515 27> BusinessRisk<-a[,16]/(a[,26]/a[,27]) > a1<-a[,1:3] > a2<-cbind(a1,BusinessRisk) > c1<-aggregate(BusinessRisk,list(a2[,1]),mean) > names(a)[1] "Co_Code" "Co_Name" "Year" "TotSholderFund" [5] "TotLiab" "NetBlock" "Investments" "Inventories" [9] "SundryDebts" "CashandBank" "TotCurrAssets" "CurrLiab" [13] "TotCurrLiab" "TotAssets" "NetSales" "OpPft" [17] "Interest" "GrossPft" "AdjNetPft" "Dividend" [21] "PrefDivi" "EquityPaidUp" "CurrentAssets" "PBIT" [25] "TotExpen" "Equity" "FaceValue"> c2<-aggregate(BusinessRisk,list(a2[,1]),sd(BusinessRisk,na.rm=TRUE))Error in FUN(X[[1L]], ...) : argument "INDEX" is missing, with no default>Please help me to overcome this error.
Ben Bolker
2007-Oct-01 15:28 UTC
[Rd] to overcome error while computing sd for each subset of data (PR#9931)
anjalishitole wrote:> > Full_Name: Anjali Shitole > Version: R 2.5.1 > OS: > Submission from: (NULL) (202.141.157.91) > > [snip] > > Please help me to overcome this error. > >Dear Mr. Shitole, * this problem is not a bug, please don't post it as such * this problem is inappropriate for the r-devel list, which is for technical questions and discussion about the workings of R, not for questions about specific analyses * please read the posting guide (URL listed in every message posted), provide a reproducible example, and resubmit your question to r-help * hint: the third argument to aggregate needs to be a function, further optional arguments can be specified. sd(x) is not a function. sd is. sincerely Ben Bolker -- View this message in context: http://www.nabble.com/to-overcome-error-while-computing-sd-for-each-subset-of-data-%28PR-9931%29-tf4532694.html#a12981381 Sent from the R devel mailing list archive at Nabble.com.
Seemingly Similar Threads
- Hint to overcome the problem with animated cursors??
- Unreal Tournament 2003 help - one last bug to overcome!
- Looking for transformation to overcome heterogeneity of variances
- How to do ANOVA with fractional values and overcome the error: Error in `storage.mode<-`(`*tmp*`, value = "double") : invalid to change the storage mode of a factor
- Looking for transformation to overcome heterogeneity ofvariances