Linear model error: fitted()
Hello,
I'm trying to use the fitted() function in order to retrieve the fitted (predicted) value of D2R at each value in G. I've tried the following R syntax but don't understand why I'm receiving the following error?
plot( fitted( lm.34852.g.at),
d2r.34852[is.na(d2r.34852$D2R),"D2R"],
xlab = "Fitted", ylab = "Observed")
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' and 'y' lengths differ
I've also tried separating the plot and fitted() portion of the code but still cannot seem to get this code to work correctly?
• 1,895 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Hello oars!
We believe that this post does not fit the main topic of this site.
This is a pure R question and the error mesage is quite self-explanatory. Please search StackOverflow
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!
Thanks Ram. I actually figured it out. I needed to add an ! before the is.
I'll try to keep my posts more in the bioinformatics lane in the future.
Because as error suggests, length of x and y are different, to reproduce the error try:
When you get an error, try to search, the first hit comes up is the StackOverflow post: