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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:56:56+00:00 2026-06-14T11:56:56+00:00

My original data set has 62 variables. For variables c(3:56) I would like to

  • 0

My original data set has 62 variables. For variables c(3:56) I would like to loop the function boxplot.with.outlier.label, see

source(“http://www.r-statistics.com/wp-content/uploads/2011/01/boxplot-with-outlier-label-r.txt”)

But I am already stuck on building a function which would allow me to built the loop. Here is some mock up data (which, of course doesn’t show outliers, but to my knowledge this is not part of the problem – proof me wrong!)

x <- rnorm(1000)
y <- rnorm(1000)
z <- sample(letters, 1000)
df <- as.data.frame(cbind(x,y,z))
df$x<- as.numeric(df$x)
df$y<- as.numeric(df$y)
df$z<- as.character(df$z)

This works fine:

boxplot.with.outlier.label(df$x, df$z)

And this does not:

boxplotlabel <- function (data, var, name) {
  datvar <- data[["var"]]
  namevar <- data[["name"]]
  boxplot.with.outlier.label(datvar, namevar)
}
boxplotlabel(df, x, z)
Error in plot.window(xlim = xlim, ylim = ylim, log = log, yaxs = pars$yaxs) :need finite 'ylim' values
In addition: Warning messages:
1: In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'
2: In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'
3: In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'
4: In min(x) : no non-missing arguments to min; returning Inf
5: In max(x) : no non-missing arguments to max; returning -Inf

Where am I going wrong? Or is there a different way of achieving my desired loop for the function boxplot.with.outlier.label?

I appreciate any help! Gerit

  • 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-14T11:56:57+00:00Added an answer on June 14, 2026 at 11:56 am

    The issue lies in the quotes. var and name are variables. But when you call data[["var"]] (with the quotes) you are not using the variable var but rather a string and the value of that string are the characters “var”.

    If you remove the quotes you will be halfway there. Var itself should have a string value. so make sure to pass it the name of the column, not the column itself.

    eg:

        # If you want to get this: 
        df$x 
    
        df[["x"]]   # right
        df[[x]]     # wrong
    

    Therefore, if we’re using a variable for x:

        # Wrong
        var <- x
        df[[var]]
    
        # Right
        var <- "x"
        df[[var]]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Crystal report where the data source has originally been set to
Would be possibile to get the original data type after applying the ArrayToStringTransformer to
original column is like: 0.45::rafas::4.0::0.0::0.9 0.35::rasaf::4.0::110.0::1.0 and i would like to break the string
I am attempting to create a data set from an original dataframe (in either
So...I have a large data set with a variable that has many categories. I
I save a big set of data where each record has a time-mark. I
Does the original data type of the username string in a call to FormsAuthentication.SetAuthCookie(...)
ORIGINAL Q: I'm wondering if anyone has had experience of migrating a large Cobol/PL1
ORIGINAL (see UPDATED QUESTION below) I am designing a new laboratory database that tests
[Original] I have a ListBox which has its ItemsSource (this is done in the

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.