Hi guys, I am doing a project to evaluate the 7 individual fund performance from a portfolio compared with all fund performance utilizing the same strategy.
Lets say in total there are 10 strategies and in the portfolio there exist 5 strategies. First, i use the BOXPLOT() and SUBSET() to produce the box plot of all the 5 funds performance individually: #identify funds in strategies within the portfolio filteredFunds = subset(allfunds,Strategy %in% portStrats); #create box plot boxplot(NetReturn~Strategy,data=filteredFunds,horizontal=TRUE) Though it produced these 5 box plot, while the Y-aix has all the 10 strategy labels. *So the FIRST QUESTION is how to eliminate the other 5 strategies on the Y-aix? * Next, I used the POINTS() to plot the performance of specific funds in the related box plot, which are from the portfolio. and used TEXTXY() to label its name. #label portfolio funds for(i in 1:T){ #loop through all strategies #get strategy strat = portStrats[i]; #identify all funds of that strategy idx = allFundStrats == strat; #get returns of the all funds rets = allFundRets[idx]; #identify portfolio funds of the same strategy portidx = fundStrats == strat; #get returns and names frets = fundrets[portidx]; fnames = fundNames[portidx]; N = length(frets); #now figure out where to put the labels s = 1 / N; for (j in 1:N){ yy = j * s + i*2; points(x=frets[j],y=yy,col="red"); textxy(X=frets[j]*-1,Y=yy,labs=fnames[j]); } } *The ERROR is Error in xy.coords(x, y) : 'x' and 'y' lengths differ* I think its because of the number of X&Y differs. Can you guy help me to fix it? Thank you so much. -- View this message in context: http://r.789695.n4.nabble.com/Help-for-boxplot-tp4633325.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.