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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:50:08+00:00 2026-05-31T20:50:08+00:00

I have the swiss data set provided by R, which has the following form:

  • 0

I have the swiss data set provided by R, which has the following form:

            Fertility Agriculture Examination Education Catholic Infant.Mortality
Courtelary       80.2        17.0          15        12     9.96             22.2
Delemont         83.1        45.1           6         9    84.84             22.2
Franches-Mnt     92.5        39.7           5         5    93.40             20.2
    .              .           .            .         .      .                 . 
    .              .           .            .         .      .                 . 
    .              .           .            .         .      .                 . 

V. De Geneve     35.0         1.2          37        53    42.34             18.0
Rive Droite      44.7        46.6          16        29    50.43             18.2
Rive Gauche      42.8        27.7          22        29    58.33             19.3

And I would like to know if there is a simple or easy way to classify the data in four groups, one for each quartile of the Education variable and then get the corresponding Infant.Mortality for each province, so I can get something like:

       Group1stQ           Group1stQ           Group1stQ          Group1stQ 

   <Mortality for      <Mortality for       <Mortality for     <Mortality for
     1st province        1st province         1st province       1st province
     on this group>     on this group>       on this group>     on this group>

   <Mortality for      <Mortality for       <Mortality for     <Mortality for
     2nd province        2nd province         2nd province       2nd province
     on this group>     on this group>       on this group>     on this group>

   <Mortality for      <Mortality for       <Mortality for     <Mortality for
     3rd province        3rd province         3rd province       3rd province
     on this group>     on this group>       on this group>     on this group>
          .                  .                    .                  .
          .                  .                    .                  .
          .                  .                    .                  .

Thanks in advance for your help!!!

  • 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-31T20:50:09+00:00Added an answer on May 31, 2026 at 8:50 pm

    what about:

    > swiss$qEdu <- cut (swiss$Education, 
                         breaks = quantile (swiss$Education, c (0, .25, .5, .75, 1)), 
                         include.lowest = TRUE)
    
    > aggregate (swiss$Infant.Mortality, list (qEdu = swiss$qEdu), FUN = mean)
         qEdu        x
    1   [1,6] 19.31429
    2   (6,8] 21.93636
    3  (8,12] 19.38182
    4 (12,53] 19.30909
    

    (I don’t really know what your numbers are – they don’t coincide with the averages I get)

    (That was before the edit…)

    (After 2nd edit:)
    If you want the Infant.Mortality for each of the provinces belongig to that quartile of Eduction, use list () as aggregation function:

    >  aggregate (swiss$Infant.Mortality, list (qEdu = swiss$qEdu), FUN = list)
         qEdu                                                                                  x
    1   [1,6] 20.2, 24.5, 18.7, 21.2, 22.4, 15.3, 21.0, 18.0, 15.1, 19.8, 18.3, 19.4, 20.2, 16.3
    2   (6,8]                   20.3, 26.6, 23.6, 24.9, 21.0, 19.1, 20.0, 23.8, 22.5, 20.0, 19.5
    3  (8,12]                   22.2, 22.2, 16.5, 22.7, 20.0, 18.0, 16.7, 16.3, 17.8, 20.3, 20.5
    4 (12,53]                   20.6, 24.4, 20.2, 10.8, 20.9, 18.1, 18.9, 23.0, 18.0, 18.2, 19.3
    

    or:

    > Infant.Mortality <- lapply (levels (swiss$qEdu), function (x) swiss$Infant.Mortality [swiss$qEdu == x])
    > names (Infant.Mortality) <- levels (swiss$qEdu)
    > Infant.Mortality
    $`[1,6]`
     [1] 20.2 24.5 18.7 21.2 22.4 15.3 21.0 18.0 15.1 19.8 18.3 19.4 20.2 16.3
    
    $`(6,8]`
     [1] 20.3 26.6 23.6 24.9 21.0 19.1 20.0 23.8 22.5 20.0 19.5
    
    $`(8,12]`
     [1] 22.2 22.2 16.5 22.7 20.0 18.0 16.7 16.3 17.8 20.3 20.5
    
    $`(12,53]`
     [1] 20.6 24.4 20.2 10.8 20.9 18.1 18.9 23.0 18.0 18.2 19.3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following data being pulled out from a databasse that is being
Have just started using Visual Studio Professional's built-in unit testing features, which as I
This is maybe unusual so let me set the scene: We have an SVN
I am working on a C++ project which has a huge code base and
Have following listener for keyboard ArrowDown event(it's key code is 40 ): window.onload =
I have downloaded a free astrology script in PHP. The script receives some data
Do anybody have any experience with retrieving live stock data for a specific stock
My employer is a large Swiss Telco. We have many Systems used to transfer
I have got the following issue <a href= class=so title=Schuko></a> <a href= class=so title=French
Have a group of related projects running in SQL Server 2005 for which I

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.