errors in plotting

Please can someone help. I am new to R Studio (please do not angry or send angry messages when I do not have full understand of the code like the experienced member who may know how to phrase things better.

I have a file that is mainly inter apart from one variable. I want to plot cell size which is inter value between 1-10 and cell shape which is inter between 1-10. There are 699 rows of data. I thought it would automatically set the axis 1-10 on x and Y and then have 699 plots. This does not happen and I get the error message

plot(breast$cl.thickness, breast$cell.size ,main="Scatterplot Example",xlab="Cell thickness ", ylab="cellsize ", pch=19)

error in plot.window(...) : need finite 'xlim' values
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf

Data source
[Breast Cancer Wisconsin (Original) - UCI Machine Learning Repository] UCI Machine Learning Repository

This is what I start with to get the data file I am using in the current session

breast <- read.csv("wisconsin.csv", header=TRUE, stringsAsFactors = FALSE)
head(breast)
tail(breast)
str(breast)

this gets me
Cl.thickness Cell.size Cell.shape Marg.adhesion Epith.c.size Bare.nuclei Bl.cromatin Normal.nucleoli Mitoses Class
1 5 1 1 1 2 1 3 1 1 benign
2 5 4 4 5 7 10 3 2 1 benign
3 3 1 1 1 2 2 3 1 1 benign
4 6 8 8 1 3 4 3 7 1 benign
5 4 1 1 3 2 1 3 1 1 benign
6 8 10 10 8 7 10 9 7 1 malignant

tail(breast)
Cl.thickness Cell.size Cell.shape Marg.adhesion Epith.c.size Bare.nuclei Bl.cromatin Normal.nucleoli Mitoses Class
694 3 1 1 1 2 1 2 1 2 benign
695 3 1 1 1 3 2 1 1 1 benign
696 2 1 1 1 2 1 1 1 1 benign
697 5 10 10 3 7 3 8 10 2 malignant
698 4 8 6 4 3 4 10 6 1 malignant
699 4 8 8 5 4 5 10 4 1 malignant
str(breast)
'data.frame': 699 obs. of 10 variables:
Cl.thickness : int 5 5 3 6 4 8 1 2 2 4 ... Cell.size : int 1 4 1 8 1 10 1 1 1 2 ...
Cell.shape : int 1 4 1 8 1 10 1 2 1 1 ... Marg.adhesion : int 1 5 1 1 3 8 1 1 1 1 ...
Epith.c.size : int 2 7 2 3 2 7 2 2 2 2 ... Bare.nuclei : int 1 10 2 4 1 10 10 1 1 1 ...
Bl.cromatin : int 3 3 3 3 3 9 3 3 1 2 ... Normal.nucleoli: int 1 2 1 7 1 7 1 1 1 1 ...
Mitoses : int 1 1 1 1 1 1 1 1 5 1 ... Class : chr "benign" "benign" "benign" "benign" ...

Am I missing something obvious

In your plotting code, you refer to the columns cl.thickness and cell.size

plot(breast$cl.thickness, breast$cell.size ,main="Scatterplot Example",xlab="Cell thickness ", ylab="cellsize ", pch=19)

You data frame seems to have the columns Cl.thickness and Cell.size, with upper case C.

tail(breast)
Cl.thickness Cell.size Cell.shape Marg.adhesion Epith.c.size Bare.nuclei Bl.cromatin Normal.nucleoli Mitoses Class

Try changing the spelling in your plot code.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.