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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:37:37+00:00 2026-05-26T20:37:37+00:00

I have a df with integer values. For purposes of classification, I’d like to

  • 0

I have a df with integer values. For purposes of classification, I’d like to replace this df with a simpler one that has pre-determined intervals instead of integers. How do I do this efficiently? An example is below:

df:

   1   2   3
1  5   3   0 
2  1   10  12
3  3   0   10

transforms into:

   1      2      3
1  [3-5]  [3-5]  [0-2]
2  [0-2]  [10-12][10-12]
3  [3-5]  [0-2]  [10-12]
  • 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-26T20:37:38+00:00Added an answer on May 26, 2026 at 8:37 pm

    Is df a data frame or a matrix? The name suggests the former, but the way you describe it suggests the latter.

    If it’s a matrix:

    df2 <- cut(df, c(0, 2, 5, 9 12))
    dim(df2) <- dim(df)
    

    If it’s a data frame:

    df[] <- lapply(df, cut, c(0, 2, 5, 9, 12))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a variable of type Hashmap <String,Integer >. In this, the Integer value
I have an integer variable ( time ) in one view controller whose value
Using Spring 2.5 tag library, I have an Integer value in a command form
I have an array with integers of values from 0 to 100. I wish
For example Dim aInt as Integer should have the value as nothing instead of
I have a dictionary where keys are strings, and values are integers. stats =
Let's say I have some_value = 23 I use the Integer 's times method
I have a dictionary (keys are integers, values are float). I would now ask
Imagine I have a csv with and each value is an integer. so the
I have to sort a number of integers, which can have values between 30.000.000

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.