Burplot error in R

I recently created a barcode in R using some sample data without any problems. Then I tried it again, using real data that was exactly the same as the sample data, except that there were more. The problem is that I get this error:

Error in barplot.default(table(datafr)) : 'height' must be a vector or a matrix 

I don't know if this helps, but when I print the table, it looks like the last rows look.

 33333 2010-09-13-19:25:50.206 Google Chrome-#135 NA [ reached getOption("max.print") -- omitted 342611 rows ]] 

Is it possible that this is too much data to process? Any suggestion on how I can fix this?

Thanks:)


EDIT 1

Hey joris

Here is the info from str (datafr):

 'data.frame': 375944 obs. of 3 variables: $ TIME : Factor w/ 375944 levels "2010-09-11-19:28:34.680 ",..: 1 2 3 4 5 6 7 8 9 10 ... $ FOCUS.APP: Factor w/ 107 levels " Finder-#101 ",..: 3 3 3 3 3 3 3 3 1 1 ... $ X : logi NA NA NA NA NA NA ... 

and from traceback ()

 3: stop("'height' must be a vector or a matrix") 2: barplot.default(table(datafr)) 1: barplot(table(datafr)) 

I also ran another command that you told me, but the feedback was super verbose; too much to print here. Let me know if you need any other information or if the latest information is really important, I can find a way to publish it.

Thanks,

+4
source share
1 answer

And, this solves the problem: you have 3 dimensions in your table, barplot cannot handle it. Take the 2 columns you want to use for the barplot function, for example:

 # sample data Df <- data.frame( TIME = as.factor(seq.Date(as.Date("2010-09-11"),as.Date("2010-09-20"),by="day")), FOCUS.APP = as.factor(rep(c("F101","F102"),5)), X = sample(c(TRUE,FALSE,NA),10,r=T) ) # make tables T1 <- table(Df) T2 <- table(Df[,-3]) # plot tables barplot(T1) barplot(T2) 

That said the plot should look interesting, to say the least. I do not know what you are trying to do, but I would say that you can reconsider your approach to it.

+4
source

All Articles