Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8325267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:22:25+00:00 2026-06-09T00:22:25+00:00

I have a quick question about R. I am trying to make a layered

  • 0

I have a quick question about R. I am trying to make a layered histogram from some data I am pulling out of files but I am having a hard time getting ggplot to work with me. I keep getting this error and I have been looking around for an answer but I haven’t seen much.

    Error: ggplot2 doesn't know how to deal with data of class uneval
    Execution halted

Here is a brief look at my program so far.

library("ggplot2")
ex <- '/home/Data/run1.DOC'
ex2 <- '/home/Data/run2.DOC'
...   
ex<- read.table(ex,header=TRUE)
ex2<- read.table(ex2,header=TRUE)
...
colnames(ex) <- c(1:18)
colnames(ex2) <- c(1:18)
...
Ex <- c(ex$'14')
Ex2 <- c(ex2$'14')
...
ggplot()+
geom_histogram(data = Ex, fill = "red", alpha = 0.2) +
    geom_histogram(data = Ex2, fill = "blue", alpha = 0.2) 

And my data is in the files and look a bit like this:

head(ex,10)
        1     2      3     4      5  6   7   8     9  10    11    12
    1  1:28   400   0.42   400   0.42  1   1   2  41.8   0   0.0   0.0
    2  1:96  5599  39.99  5599  39.99 34  42  50 100.0 100 100.0 100.0
    3  1:53   334   0.63   334   0.63  1   2   2  62.1   0   0.0   0.0
    4  1:27  6932  49.51  6932  49.51 48  52  57 100.0 100 100.0 100.0
    5  1:36 27562 124.15 27562 124.15 97 123 157 100.0 100 100.0 100.0
    6  1:14  2340  16.71  2340  16.71 13  17  21 100.0 100 100.0  95.7
    7  1:96  8202  49.71  8202  49.71 23  43  80 100.0 100 100.0 100.0
    8  1:34  3950  28.21  3950  28.21 22  33  36 100.0 100 100.0 100.0
    9  1:60  5563  24.62  5563  24.62 11  24  41 100.0 100  96.5  75.2
    10 1:06  1646   8.11  1646   8.11  7   8  13 100.0 100  87.2  32.0
          13    14    15    16   17   18
    1    0.0   0.0   0.0   0.0  0.0  0.0
    2   93.6  82.9  57.9  24.3  0.0  0.0
    3    0.0   0.0   0.0   0.0  0.0  0.0
    4  100.0  97.1  87.1  57.1  0.0  0.0
    5  100.0 100.0 100.0 100.0 88.3 71.2
    6   40.0   0.0   0.0   0.0  0.0  0.0
    7   81.2  66.7  54.5  47.9 29.1  0.0
    8   76.4  55.7   0.0   0.0  0.0  0.0
    9   57.5  35.4  26.5   4.4  0.0  0.0
    10   0.0   0.0   0.0   0.0  0.0  0.0

But much larger. This means that ex and ex2 will be a percentage from 0 to 100. The colnames line changes the column heads like %_above_30 to something R likes better so I change it to number each column name.

Does anyone know/see the problem here because I am not really getting it.
Thanks!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:22:27+00:00Added an answer on June 9, 2026 at 12:22 am

    Maybe try combining the two data frames in one and supply that to one geom_histogram:

    #maybe reshape it something like this (base reshape or the 
    #reshape package may be a better tool)
    dat <- data.frame(rbind(ex, ex2), 
        colvar=factor(c(rep("ex", nrow(ex)), rep("ex2", nrow(ex2))))
    
    ggplot(data = dat, fill = colvar)+
        geom_histogram(position="identity", alpha = 0.2)
    

    This is untested as your code isn’t reproducible (please see this link on how to make a reproducible example).

    Here’s the idea I’m talking about with a reproducible example:

    library(ggplot2) 
    path = "http://www-stat.stanford.edu/~tibs/ElemStatLearn/datasets/SAheart.data" 
    
    saheart <- read.table(path, sep=",",head=T,row.names=1) 
    fmla <- "chd ~ sbp + tobacco + ldl + adiposity + famhist + typea + obesity" 
    model <- glm(fmla, data=saheart, family=binomial(link="logit"), 
        na.action=na.exclude) 
    dframe <- data.frame(chd=as.factor(saheart$chd), 
        prediction=predict(model, type="response")) 
    
    ggplot(dframe, aes(x=prediction, fill=chd)) + 
        geom_histogram(position="identity", binwidth=0.05, alpha=0.5) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have quick question about jQuery plugins, hope somebody out there has some advice.
I have a quick question about how to serve data from a repository in
Quick question about include/requre_once . I have some code that is common to a
I have a quick question about fetching results from a weakly typed cursor and
A quick question about the UISegmentedControl class on the iPhone. Hopefully, some may have
I have a quick question about programming using Vim. I sometimes make a silly
I have quick question about text parsing, for example: INPUT=a b c d e
I have a quick question about something I imagine must be pretty easy -
I have a quick question about ARC in iOS. (Sorry I've asked so many
I have a quick question about encapsulating specific types with typedef . Say I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.