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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:19:10+00:00 2026-06-12T06:19:10+00:00

R is used for statistical computing. I don’t know statistics never worked with R.

  • 0

R is used for statistical computing. I don’t know statistics never worked with R. I was given this formula in “R” to solve a problem, but need help to translate it into either MySQL or PHP. Below is a direct quote:

In R we can compute

x <- matrix(c(-954234, 3589, 43243455, 2521, 149940475, 3939,     243853640, 3936, 262995399, 3025, 751195421, 5333, 10677437299, 7477), ncol=2, byrow=TRUE); y     <- apply(x, 2, sum); y[1] / y[2],

producing $406,697 for the average.

Some background information on this. This is data from the IRS 2008 for Income Tax data by zip code. The above data is from a single zip code (10021). The table (please see below). The task is to create an Average Adjust Gross Income (AGI), and the above R example is the solution. Thanks!

1 = 'Under $10,000' 
2 = '$10,000 under $25,000' 
3 = '$25,000 under $50,000' 
4 = '$50,000 under $75,000' 
5 = '$75,000 under $100,000' 
6 = '$100,000 under $200,000' 
7 = '$200,000 or more '

“Number of Returns” is the Number of tax returns for that agi_class.

mysql> select A00100,zipcode,agi_class,N1 as 'Number of Returns' from taxbyzip2008 where zipcode="10021";

+-------------+---------+-----------+-------------------+ 
| A00100      | zipcode | agi_class | Number of Returns | 
+-------------+---------+-----------+-------------------+ 
| -954234     | 10021   | 1         | 3589              | 
| 43243455    | 10021   | 2         | 2521              | 
| 149940475   | 10021   | 3         | 3939              | 
| 243853640   | 10021   | 4         | 3936              | 
| 262995399   | 10021   | 5         | 3025              | 
| 751195421   | 10021   | 6         | 5333              | 
| 10677437299 | 10021   | 7         | 7477              | 
+-------------+---------+-----------+-------------------+
  • 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-12T06:19:11+00:00Added an answer on June 12, 2026 at 6:19 am

    try this :

    select sum(A00100)/sum(N1) as 'average' from taxbyzip2008 where zipcode="10021";
    

    OR quick try:

    mysql> select (-954234 + 43243455 +149940475 + 243853640 + 262995399 + 751195421+10677437299)/(3589+2521 +3939 +3936 +3025  + 5333 + 7477) ;
    

    your formula is sum of A00100 divide by sum of N1 field 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For statistical reasons, we need to know how often our library (jar) is used.
I'm trying to evaluate the purchase of a statistical tool. This will be used
i used this code: List<string> lists=new List<string>(apple,orange,banana,apple,mang0,orange); string names; names=lists.Distinct() is that correct?
Parallel computing is used more and more, and new framework features and shortcuts make
What is statistical debugging? I haven't found a clear, concise explanation yet, but the
I'm creating a package that is going to be used by R (the statistical
I want to solve word splitting problem (parse words from long string with no
I want to save everything that can be used for statistics, such as referrer,
What is the easiest way to get network statistics (bandwidth used, current down/up rate)
We have an R Server (R is a programming language used in statistical analysis)

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.