Hello,

 

I am working on a project to create some scatter plots.  I have syntax
for 26 plots, and 22 of them display as they should.  But here, for
example, is a sample of the command syntax I am using:

 

good <- complete.cases(affect1,adh1scr)

plot
(jitter(affect1,2.0),jitter(adh1scr,1.0),xlim=c(1,35),ylim=c(1,35),pch=1
6,

main='Adherence Score by Affectiveness Level - Visit 1',

ylab='Adherence score',xlab='Affect Scale - Patient
Survey',abline(lsfit(affect1,adh1scr)),col="red")

lines(lowess(affect1[good], adh1scr[good]), col="blue")

 

I run this and get:

 

> good <- complete.cases(affect1,adh1scr)

> plot
(jitter(affect1,2.0),jitter(adh1scr,1.0),xlim=c(1,35),ylim=c(1,35),pch=1
6,

+  main='Adherence Score by Affectiveness Level - Visit 1',

+ ylab='Adherence score',xlab='Affect Scale - Patient
Survey',abline(lsfit(affect1,adh1scr)),col="red")

Error in xy.coords(x, y, xlabel, ylabel, log) : 

  'x' and 'y' lengths differ

> lines(lowess(affect1[good], adh1scr[good]), col="blue")

Error in xy.coords(x, y) : 'x' and 'y' lengths differ

 

The data is a bit skewed towards the high end, but I found other
variables that skew even more and they produce graphs.  I've taken out
the ABLINE and LINES options and the problem persists.  I tried changing
the name of the AFFECT1 variable, the problem exists.  I tried changing
the values of XLIM and YLIM (the range for the X and Y variables are
both 1 and 35); I still get the same error.  There are enough valid
cases to create a scatter plot (two of the plots will have 211 valid
cases, the other two will have 163 valid cases).

 

This occurs in the middle of my command file.  So - I know that the
variables are being read into R correctly (no error messages from R when
I define the variables), and similar syntax for other variables works -
it's just these 4 variables (AFFECT1, AFFECT2, INFOSC1, INFOSC2) that
produce the "Error in xy.coords" message.

 

Any help that anyone can give regarding this would be helpful.  

 

Sincerely,

 

Steve Alspach 

Jesse Brown Veterans' Administration Hospital

steven.alsp...@va.gov

 


        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to