1

The data for my code is payments <- read.csv("payments.csv", header = TRUE) The data file payments.csv was used which I uploaded here: https://github.com/Bheal/Board-Q-A

I am learning R and wanted to accomplish the same this ggplot(payments, aes( x = Average.Total.Payments, y = Average.Covered.Charges)) + geom_point() + facet_grid(DRG.Definition ~ Provider.State) in base plotting, so I tried this:

par(mfrow = c(6,6))

for(state in unique(payments$Provider.City)) {
  for(condition in unique(payments$DRG.Definition)) {
    data.sub <- subset(payments, Provider.State == state & DRG.Definition == condition)
with(data.sub, plot(Average.Total.Payments ~ Average.Covered.Charges))
  }
}

I am getting the following error:

Error in plot.new() : figure margins too large
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf

I believe that first I have to to experiment on par() settings. And maybe my intended 6x6 panel will show, but don't know where to start and while I search the web, wanted to post this here for relevant critique and advise. Thanks.

Bhail
  • 385
  • 1
  • 2
  • 18
  • I have read this and another post on stackoverflow but I can neither get the 6x6 graph that I want nor do I know what should I change my `par(mar=c(..)` to. I tried something like c(1,1,1,1) and the error changed to `Error in plot.window(...) : need finite 'xlim' values`... is there a source that one should turn to for explanation of all the par settings? – Bhail Jan 07 '17 at 17:41

0 Answers0