FAQ
i am working on the project to analyze hedge fund performance, i would
appreciate that if you guys could spare some time helping me out with the R
code. Thanks.

The senario is:

i applied BOXPLOT() to plot the performance of all hedge funds with 7
strategies.

And right now in this boxplot I need to plot the points of 30 individual
hedge funds from my portfolio. And I applied POINTS() and TEXTXY() to label
these points.

There are 30 funds in my portfolio with 7 different strategies.

"FundName"(fundNames), "fundStrats", "Return"(fundrets)

Here is my code:

for(i in 1:T){
# T equals to the amount of strategies in my portfolio

strat = portStrats[i];
#get strategy

portidx = fundStrats == strat;
# identify portfolio funds of the same strategy

frets = fundrets[portidx];
fnames = fundNames[portidx];
#get returns and names,? frets?: fund return, ?fnames?:fund name

N = length(frets);

s = 1 / N; #now figure out where to put the labels
for (j in 1:N){
yy = j * s + i*1;
points(x=frets[j],y=yy,col="red");
textxy(X=frets[j],Y=yy,labs=fnames[j]);
}

}

Right now the question is that, The ERROR is Error in xy.coords(x, y) : 'x'
and 'y' lengths differ.
So how to fix it?

Thank you so much.

--
View this message in context: http://r.789695.n4.nabble.com/help-with-xy-coords-x-y-tp4633785.html
Sent from the R help mailing list archive at Nabble.com.

## Search Discussions

•  at Jun 19, 2012 at 2:47 pm ⇧

On Jun 18, 2012, at 9:53 PM, adamshun wrote:

i am working on the project to analyze hedge fund performance, i would
appreciate that if you guys could spare some time helping me out
with the R
code. Thanks.

The senario is:

i applied BOXPLOT() to plot the performance of all hedge funds with 7
strategies.

And right now in this boxplot I need to plot the points of 30
individual
hedge funds from my portfolio. And I applied POINTS() and TEXTXY()
to label
these points.

There are 30 funds in my portfolio with 7 different strategies.

"FundName"(fundNames), "fundStrats", "Return"(fundrets)

Here is my code:

for(i in 1:T){
# T equals to the amount of strategies in my portfolio

strat = portStrats[i];
#get strategy

portidx = fundStrats == strat;
# identify portfolio funds of the same strategy

frets = fundrets[portidx];
fnames = fundNames[portidx];
#get returns and names,? frets?: fund return, ?fnames?:fund name

N = length(frets);

s = 1 / N; #now figure out where to put the labels
for (j in 1:N){
yy = j * s + i*1;
points(x=frets[j],y=yy,col="red");
textxy(X=frets[j],Y=yy,labs=fnames[j]);
}

}

Right now the question is that, The ERROR is Error in xy.coords(x,
y) : 'x'
and 'y' lengths differ.
So how to fix it?
You posted a very similar question on SO and have gotten specific
advice about what was needed for resolution. You have so far not
responded constructively to those suggestions. Please choose one venue
for your questions and stick with it. Cross-posting is deprecated on
Rhelp. The SO advice to post a data example that creates the error
appears on point. Both of those points are outlined in the Rhelp
Posting Guide. If you choose to continue on Rhelp then I suggest you
delete the SO question.

--
David.

Thank you so much.

--
View this message in context: http://r.789695.n4.nabble.com/help-with-xy-coords-x-y-tp4633785.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
West Hartford, CT

## Related Discussions

Discussion Overview
 group r-help categories r posted Jun 19, '12 at 1:53a active Jun 19, '12 at 2:47p posts 2 users 2 website r-project.org irc #r

### 2 users in discussion

Content

People

Support

Translate

site design / logo © 2022 Grokbase