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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:43:04+00:00 2026-06-02T22:43:04+00:00

I cannot find out how to list and print all objects in a workspace.

  • 0

I cannot find out how to list and print all objects in a workspace. I’d like to see them all and understand what’s going on. For example, ls() gives you 30 objects. How, besides typing them individually, is it possible to display them all. Seems so trivial, the solution will probably quite embarrasing. The closest I’ve come was ls.str() and the idea of looping over the objects.

Edit: This is not for data frames. I have a workspace full of functions, without data, and like to understand which ones reference which etc.

  • 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-02T22:43:05+00:00Added an answer on June 2, 2026 at 10:43 pm

    Do you mean ‘display’ in the sense of “for every object in ls(), I want to see what I would see if I typed it into the prompt”? What if you have some matrix that’s 1000×10000 – you still want to print it? I personally like ls.str() – I think it gives a nice concise overview of everything, and handles the case I just mentioned nicely.

    However if you want to basically “display” every object in the sense of typing each on the prompt, I’d suggest a loop:

    for ( obj in ls() ) { print(get(obj)) }
    

    Since ls() returns a character vector of variable names, I need to use get(obj) which gets the variable whose name is in obj.

    You may wish to do a variation of this in order to print the variable name too, e.g.

    for ( obj in ls() ) { cat('---',obj,'---\n'); print(get(obj)) }
    

    As an example:

    > a <- 1
    > b <- LETTERS[1:10]
    > c <- data.frame(a=LETTERS[1:10],b=runif(10))
    > for ( obj in ls() ) { cat('---',obj,'---\n'); print(get(obj)) }
    --- a ---
    [1] 1
    --- b ---
     [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J"
    --- c ---
       a         b
    1  A 0.1087306
    2  B 0.9577797
    3  C 0.8995034
    4  D 0.1434574
    5  E 0.3548047
    6  F 0.1950219
    7  G 0.1453959
    8  H 0.4071727
    9  I 0.3324218
    10 J 0.4342141
    

    This does have a drawback though – next time you call ls() there’s now an obj in there. I’m sure there’s some workaround though.

    Anyhow, I think I still prefer ls.str() for the way it handles big objects (but I work with a lot of huge (millions of elements) matrices, so that’s my preference).

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

Sidebar

Related Questions

Ive tried searching for hours now and cannot find out why my code (aka,
i tried to find it out with previous answers but i cannot do it
Cannot find any example on Google.
i cannot find any way to execute this - all i need is to
I cannot find the solution for this problem, here is the simplified example: On
I'm new with SQL Reporting Services 2008 and cannot find out how to do
I cannot find out how to obtain destination element with jQuery UI sortable. $(#pages).sortable({
I'm building a site with nanoc and cannot find out how to use a
My collection is not rendering for some reason. Cannot find out why. TreeItem =
I cannot find a maven repository for Lucene 4.0. I don't want to use

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.