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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:37:44+00:00 2026-05-30T23:37:44+00:00

Been using SAS for 6 years and migrating across to R. I used to

  • 0

Been using SAS for 6 years and migrating across to R. I used to use proc contents to get a healthy description of a table, a characteristic and a data type.

Using str(tableName) I can see the type but not the vector position in a data frame.

Using name(tableName) I can see the names and positions of the vectors but not the type.

Using summary(tableName) I can see the quantiles/category but not the type easily or vector position.

Is there a way I can just get a list of
Name vectorPosition type min max avg med [..]

  • 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-30T23:37:45+00:00Added an answer on May 30, 2026 at 11:37 pm

    You can use lapply to call a function
    on each column of the data.frame,
    and compute all the quantities you want in that function.

    summary_text <- function(d) {
      do.call(rbind, lapply( d, function(u)
        data.frame(
          Type    = class(u)[1],
          Min     = if(is.numeric(u)) min(   u, na.rm=TRUE) else NA,
          Mean    = if(is.numeric(u)) mean(  u, na.rm=TRUE) else NA,
          Median  = if(is.numeric(u)) median(u, na.rm=TRUE) else NA,
          Max     = if(is.numeric(u)) max(   u, na.rm=TRUE) else NA,
          Missing = sum(is.na(u))
        )    
      ) )
    }
    summary_text(iris)
    

    But I personnally prefer to look at the data graphically:
    the following function will draw a histogram and a quantile-quantile plot
    for each numeric variable, and a barplot for each factor,
    on a single page. If you have 20 to 30 variables, it should remain usable.

    summary_plot <- function(d, aspect=1) {
      # Split the screen: find the optimal number of columns 
      # and rows to be as close as possible from the desired aspect ratio.
      n <- ncol(d)
      dx <- par()$din[1]
      dy <- par()$din[2]
      f <- function(u,v) {
        if( u*v >= n && (u-1)*v < n && u*(v-1) < n ) {
          abs(log((dx/u)/(dy/v)) - log(aspect))
        } else { 
          NA 
        }
      }
      f <- Vectorize(f)
      r <- outer( 1:n, 1:n, f )
      r <- which( r == min(r,na.rm=TRUE), arr.ind=TRUE )
      r <- r[1,2:1]
    
      op <- par(mfrow=c(1,1),mar=c(2,2,2,2))
      plot.new()
      if( is.null( names(d) ) ) { names(d) <- 1:ncol(d) }
      ij <- matrix(seq_len(prod(r)), nr=r[1], nc=r[2], byrow=TRUE)
      for(k in seq_len(ncol(d))) {
        i <- which(ij==k, arr.ind=TRUE)[1]
        j <- which(ij==k, arr.ind=TRUE)[2]
        i <- r[1] - i + 1
        f <- c(j-1,j,i-1,i) / c(r[2], r[2], r[1], r[1] )
        par(fig=f, new=TRUE)
        if(is.numeric(d[,k])) { 
          hist(d[,k], las=1, col="grey", main=names(d)[k], xlab="", ylab="")
          o <- par(fig=c(
              f[1]*.4  + f[2]*.6,
              f[1]*.15 + f[2]*.85,
              f[3]*.4  + f[4]*.6,
              f[3]*.15 + f[4]*.85
            ), 
            new=TRUE,
            mar=c(0,0,0,0)
          )
          qqnorm(d[,k],axes=FALSE,xlab="",ylab="",main="")
          qqline(d[,k])
          box()
          par(o)
        } else {
          o <- par(mar=c(2,5,2,2))
          barplot(table(d[,k]), horiz=TRUE, las=1, main=names(d)[k])
          par(o)
        }
      }
      par(op)
    }
    summary_plot(iris)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If been using dbForge Query Builder lately and I'm gotten used to the ease
I been using LDAP for alot of years now and most of the firms
I've been using Union on IQueryable<> (with the same type) to try to get
For some years that I've been using my own PHP template engine, which is
Been using XML for ages now for data storage & transfer, but have never
Ive been using bootstrap for a few months and am looking to clarify something
I been using VS2008 Pro for a long time now but since of licensing
I have been using TortoiseSVN for some time and I really like it. I
I've been using this script for a long time and it works perfectly in
I have been using Stanford POS Tagger to tag parts of speech in a

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.