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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:30:14+00:00 2026-05-23T22:30:14+00:00

I started using the lattice graphic package but I stumbled into a problem. I

  • 0

I started using the lattice graphic package but I stumbled into a problem. I hope somebody can help me out.
I want to plot a histogram using the corresponding function.

Here is the file foo.r:

library("lattice")

data <- data.frame(c(1:2),c(2:3))
colnames(data) <- c("RT", "Type")

pdf("/tmp/baz.pdf")
histogram( ~ RT | factor(Type), data = data)
dev.off()

When I run this code using R --vanilla < foo.r it works all fine.

However, if I use a second file bar.r with

source("bar")

and run R --vanilla < bar.r the code produces an erroneous pdf file.
Now I found out that source("bar", echo=TRUE) solves the problem. What is going on here? Is this a bug or am I missing something?

I’m using R version 2.13.1 (2011-07-08) with lattice_0.19-30

  • 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-23T22:30:15+00:00Added an answer on May 23, 2026 at 10:30 pm

    It is in the FAQ for R — you need print() around the lattice function you call:

    7.22 Why do lattice/trellis graphics not work?

    The most likely reason is that you forgot to tell R to display the
    graph. Lattice functions such as xyplot() create a graph object, but
    do not display it (the same is true of ggplot2 graphics, and Trellis
    graphics in S-Plus). The print() method for the graph object produces
    the actual display. When you use these functions interactively at the
    command line, the result is automatically printed, but in source() or
    inside your own functions you will need an explicit print() statement.

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

Sidebar

Related Questions

Just started using App Engine's webapp framework, but I can't figure out what's wrong
I started using andEngine yesterday but I'm pretty confused.. I want to make a
I started using rails_admin engine lately and can't quite figure out how I can
I started using the Telerik Html.Grid today and have already run into a problem.
I started using Core Data for iPhone development. I started out by creating a
i started using nginx upload module (which creates upload files like /tmp/000121545) but i
I started using Zend_Paginator, it works everything fine but I noticed that there is
I started using core data and I read that I can save the data
I've just started using google charts and want to use it in a small
I just recently started using this library (the one from CodePlex), but I ran

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.