Merging Datasets and "Invalid number of breaks" error

Hello again RStudio wizards!

I am needing some major help in understanding an issue of mine: I am combining/merging two datasets and in turn, I am trying to create a histogram of one of the elements that both datasets contain. However, I receive an error saying "Error in hist.default(SalePrice) : invalid number of 'breaks'".

As a background of the data, both datasets have "SalePrice" values for homes in different locations. I wanted to merge these datasets to reflect the differences in sale prices alone and then combine them to show differences after the combination. Does anyone have any suggestions?

Thank you so much,
Aerianna

You'll need to share the code and some data that reproduces the problem, see here for advice on making a minimal reproducible example:

Like stated before, the data includes information about different houses in certain areas of the US. I am only selecting two sets of the same data:

ex. Michigan
-SalePrice
-YearBuilt
-LotArea
-OverallQual
...

Texas
-SalePrice
-YearBuilt
-LotArea
-OverallQual
...

They both have all the same attributes, with the exception of the datasets resembling another geographical location. I am only interested in the sale price and am trying to combine the sale prices together to display a histogram.

I can't conveniently quote and comment on your code as its an image.
But I will say when you arent confident coding, you shouldnt skip steps, be as methodical as possible.

Attaching the result of a merge and then assuming you know what the results would be is an example I think...

Why not merge and assign the merge to a named object. Then investigate / check that object is how you expect. I would guess that the columns share sale price name so one is relabeled with .x and other with .y so then the call to hist would fail as there is no such variable as named.

1 Like

This topic was automatically closed 21 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.