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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:36:32+00:00 2026-05-28T07:36:32+00:00

I have a dataframe called data where I would like to rescale the values

  • 0

I have a dataframe called data where I would like to rescale the values in the 4th field to a range of 0-1000 and round the scaled value to the nearest integer. I’m trying to use ddply, round and rescale:

scaled_data <- ddply(data, round(rescale(data[,4], to=c(0,1000), from=range(data[,4], na.rm=TRUE)), 0)

The above code throws this error:

Error in `[.data.frame`(envir, exprs) : undefined columns selected

Can anyone point out the problem or a better way to accomplish what I am trying to do?

  • 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-28T07:36:32+00:00Added an answer on May 28, 2026 at 7:36 am

    I think you’re making it too complicated — I don’t see why you need ddply at all.

    dd[,4] <- round(ggplot2::rescale(dd[,4],to=c(0,1000))
    

    (I’m using ggplot2::rescale because you did, but (x-min(x))/diff(range(x))*1000 would do the same thing)

    Or if you know the name of the fourth column you can:

    dd <- transform(dd,fourth=rescale(fourth,to=c(0,1000)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got a data frame (which is called data.set.y). And I would like
I have a dataframe with numeric entries like this one test <- data.frame(x =
I have a dataframe with a column of integers that I would like to
Suppose I have a dataframe like this one: df <- data.frame (id = c(a,
I have a file, called genes.txt , which I'd like to become a data.frame.
i have a data frame like this A B value 1 1 0.123 2
I have a dataframe called ants detailing multiple entries per site, looks like this:
I would like to transform/modify the content of dataframe. Basically I have a dataframe
I have a whole bunch of data.frames with irregular time spacing. I would like
I would like to aggregate a data.frame by an identifier variable called ensg .

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.