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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:16:26+00:00 2026-06-12T09:16:26+00:00

I have a dataframe with test values of 20 different teststeps from some units

  • 0

I have a dataframe with test values of 20 different teststeps from some units (e.g. unit 1..5)
In addition I have 2 columns with lower and upper limit (ll and ul)

data <- data.frame(
    ll=round(runif(20,5,15)),
    ul=round(runif(20,80,95)),
    unit1=sample(1:100,20,TRUE),
    unit2=sample(1:100,20,TRUE),
    unit3=sample(1:100,20,TRUE),
    unit4=sample(1:100,20,TRUE),
    unit5=sample(1:100,20,TRUE)
)

How do I get a count of values for each row which are below the lower limit (ll) and what count is above the upper limit (ul)?

  • 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-12T09:16:27+00:00Added an answer on June 12, 2026 at 9:16 am

    Try this:

    below <- rowSums(data[,-c(1,2)] < data[,'ll'])  # below
    above <- rowSums(data[,-c(1,2)] > data[,'ul'])  # above
    DF <- cbind(data, below, above) # altogether
    head(DF)
      ll ul unit1 unit2 unit3 unit4 unit5 below above
    1 10 82    75    10    24    80    60     0     0
    2 13 87    60    20     4    94    31     1     1
    3  8 85    58     9    98    94    65     0     2
    4 11 95    68    45     5    38    76     1     0
    5 11 87    15    79     5    43    67     1     0
    6 11 89    33     6    18     1    22     2     0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dataframe with some numeric columns. Some row has a 0 value
I have the dataframe p3 below: test result 1 1 26.87778 2 1 24.52598
I have a dataframe with numeric entries like this one test <- data.frame(x =
I have a dataframe x with this values: x1 x2 x3 1 NA 4
I have a dataframe with over 200 columns. The issue is as they were
I have a dataframe with 3 columns $x -- at http://pastebin.com/SGrRUJcA $y -- at
This is a follow up question from R: t-test over all columns Suppose I
I have made a start to create some training and test sets using 10
Update: My apologies... I should have specified that there are missing values for some
I have the dataframe test <- structure(list( y2002 = c(freshman,freshman,freshman,sophomore,sophomore,senior), y2003 = c(freshman,junior,junior,sophomore,sophomore,senior), y2004

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.