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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:49:16+00:00 2026-05-22T20:49:16+00:00

I have a data file consisting of 57 variables. I want to transform about

  • 0

I have a data file consisting of 57 variables. I want to transform about 12 of them into z-scores due to their uneven level of measurement. I looked up internet resources and help files. One internet resource adviced that I need the package Rbasic (does not exist). I used scale() which only seemed to center the variables. I tried V5-mean/st.dev. which got me very strange scores. Can somebody please give me practical adivce?

  • 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-22T20:49:17+00:00Added an answer on May 22, 2026 at 8:49 pm

    scale() is the correct choice here:

    > x <- 1:10
    > scale(x)
                [,1]
     [1,] -1.4863011
     [2,] -1.1560120
     [3,] -0.8257228
     [4,] -0.4954337
     [5,] -0.1651446
     [6,]  0.1651446
     [7,]  0.4954337
     [8,]  0.8257228
     [9,]  1.1560120
    [10,]  1.4863011
    attr(,"scaled:center")
    [1] 5.5
    attr(,"scaled:scale")
    [1] 3.02765
    > (x - mean(x)) / sd(x)
     [1] -1.4863011 -1.1560120 -0.8257228 -0.4954337 -0.1651446
     [6]  0.1651446  0.4954337  0.8257228  1.1560120  1.4863011
    > mean(x)
    [1] 5.5
    > sd(x)
    [1] 3.02765
    

    Notice how the attributes in the object returned from scale() are the mean and SD of the input data.

    Now you don’t provide real code to show how you computed “V5-mean/st.dev” but if you did it exactly like that the operator precedence might have caught you out. This for example doesn’t return the correct z-scores:

    > x - mean(x) / sd(x)
     [1] -0.8165902  0.1834098  1.1834098  2.1834098  3.1834098
     [6]  4.1834098  5.1834098  6.1834098  7.1834098  8.1834098
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a data file that I want to process; I want to
i have a data file(csv) consisting of 2 columns & 1000 rows, as i
I have a large data file consisting of a single line of text. The
I have 'data.xlsx' file with cells of numbers and letters. when I run this
I have a data file that looks like this: xyz123 2.000 -0.3974 0.0 hij123
I have a data file, which I need to read. I know to read
I have a data file that looks like the following example. I've added '%'
I have a data file with the # sign as delimiter, that I would
I have a data file which is comprised of rows of data, newline separated.
I have a data file, a signature file (created by the GnuPG) and 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.