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 6816523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:56:10+00:00 2026-05-26T20:56:10+00:00

I am having a problem with a couple R functions I wrote. I have

  • 0

I am having a problem with a couple R functions I wrote. I have 2 plotting functions and I want to write a function that creates plots for both of the functions. This function looks like this

 plotBoth = function(path = NULL){
     plotPopulationStats(path)
     plotInstructionFrequencies(path)
 }

However only whichever instruction I call second gets plotted, while the first instruction only plots a blank window. Below are simplified versions of these functions.

 plotInstructionFrequencies = function(path = NULL){
   quartz()
   table <- read.table(path, header=TRUE);
   frame <- as.data.frame(table);
   frame$time = seq(1, length(table$noop));
   frame$mean = NULL
   frame$sd = NULL
   frame$variance = NULL
   Molten <- melt(frame, id.vars = "time");
   ggplot(Molten, aes(x = time, y = value, colour = variable)) + geom_line()
}

and

plotPopulationStats = function(path = NULL){
    quartz()
    table <- read.table(path, header=TRUE);
    frame <- as.data.frame(table);
    frame$time = seq(1, length(table$noop));
    frame$noop = NULL
    frame$plus = NULL
        ...
    frame$store = NULL
        Molten <- melt(frame, id.vars = "time");
    ggplot(Molten, aes(x = time, y = value, colour = variable)) + geom_line();
}

All the functions are in separate files, but I would like to have them all in one file.

Both functions plot fine when called individually.

  • 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-05-26T20:56:11+00:00Added an answer on May 26, 2026 at 8:56 pm

    Read Faq 7.22:
    http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f

    You need to print() your ggplot or lattice plots.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been going at this problem for a solid couple hours now and having
We are having problem with the server migration. We have one application that are
The Problem: Exercise 2-8 of The C Programming Language, Write a function rightrot(x,n) that
I have a couple of functions that I know work correctly. One just counts
I'm having problem when running my Windows Forms program. In the program, I have
Working on a simple helper function in PowerShell that takes a couple of parameters
I have an CarrierWave ImageUploader which creates a couple of versions of an original
I have a self-hosted WCF service and I'm having the following problem: 15 minutes
I am having a problem of calling the user defined JS function after I
I'm having this problem right now: given a month and a year, I'd need

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.