Select Page

Using R to analyze Worlds Trends of Life Expectancy and Birth Rate

by | Dec 15, 2022 | Uncategorized | 0 comments

Join our founder Peter Koebel as he demonstrates Using R to analyze Worlds Trends of Life Expectancy and Birth Rate.

Population and world trend data is some of the most fun to analyze and apply data science tools to. Using R to analyze Worlds Trends of Life Expectancy and Birth Rate is an eye-opening excercise.

Read the video transcript below:

Hello it’s Peter Keobell here again from

Datasciencing Consultants making

another video before Deus sciencing calm

this video will be data sensing world

trends on life expectancy in birth rooms

and so I already have three vectors

loaded that I need for the analysis also

I have published this on my art Cubs

account here you’ll see the vectors as I

didn’t need you add them put a video and

so we’ll start here by England C do is

set trends

no there’s codes we’ll explore the Dino

briefly the whole thing 200 countries

I’m not sure if this is sorted on so

we’ll look at the it was like the top

deep with the bottom eight just to get a

better idea so here we have country name

just country codes the regions year and

the fertility rate and country code here

like the Americas that include North

America Central America South America

Bahamas which is a point to note some

lot of places outside Canada and the USA

call the whole continent the Americas or

the calling one from there the American

and Canada need on the United States

usually someone who’s American if

they’re from the United States so they

came to confusion happen with me a

couple times to us traveling be from

Canada so I’m called an American I

thought their Sam from USA not correct

them saying oh I’m nothing yet not an

American I’m from Canada which is weird

it’s like saying Oh cuz I’m Swiss some

say oh you’re European I’m saying about

your peanut Swiss just uh we just do a

different way to describing

regions silver so one clarified here the

region Americas is four and here we see

the bottom meat he’s Oceania that is

another one that not everyone here’s a

book that’s Australia and New Zealand

Tasmania and not trivia the islands

ramble by law – and Samoa not sure the

exact difference between the border

between Oceania and Asia that’s just the

region that the empire referencing

Middle East I’m not sure the exact

strict borders there as well and so

these are the tallies at the bottom this

is alphabetical now who’s at the bottom

each alphabetically except for dinner

card probably come I’m not sure where

that one store and so then we’ll check

the structure of the different see

what’s going on some here country names

a factor I was higher 87 different

countries there you said four different

country codes it’s good to do the same

so each country you should have a

country code and there’s six regions and

there’s the integers of the different

years or for each row has a year and

there’s the fertility rate for each of

those I have a look at the summary and

we’ll just explore the day says before

we start working it I’ve already looked

at this before but you forget her random

dataset from someone’s good to check

things out of it

and so here we have Cartier my gonna

country code the regions well the

different countries fruits region and

here’s the year that made of the lowest

years 1960 now max 2013 here’s the

median mean average and the middle so

this problem means that there’s only

these two years and this is just the

average of the two years and here we can

see there’s 262 problems so that is just

double when I’m getting seven so I mean

I right look today since 1960 2015 oMG

years but it’s good to review that in

case it’s a you need to say you haven’t

seen yet and

years you tiller a minute max this is

seeking uh just dis called analysis

which we don’t need you know and now it

will verify the years how many different

years that were or R&D asset and yeah it

just seems to split 1960 2013 is this 53

53 year gap and between the different

data sets and so here we we filled our

data frames between 1960 and 2013 now

I’ll check with make sure those slip

properly there’s one hundred seventy

eighty hundred eighty seven rows each

and I’ll just make a note so just

someone looks at that later can verify

they don’t runs ahead you can see is

this I’m your son’s rows for that cool

and I check the rows for 2013 and in

journals so 180 270 so make a note so

I’m just 87 rows each data frame which

there’s an equal split and I’ll create

to show date frames for the like this

back to see Jake frames and I’ll just

put them all into place of vectors I

already had put your own game froze

let’s retrieve this space or something

out looking since long time I like

looking in the middle my ski house check

the summaries for these again just

assume so I

you can see so there’s only one country

for code it’s good and 181 others

because there’s six yet 6 and 6-plus

hundred you want a 787 and here we can

see the the lowest life expectancy is 28

so there’s at least one country that’s

28 our life expectancy at birth was 28

and the maximum so the most any country

has had 73 so when you’re born that

country expectancy was seven three and a

half years and now check what’s going on

in 2013 and so we can see again every 1

plus 2 6 so that’s all the countries and

life expectancy here the lowest was

almost 49 years so it’s a huge increase

50%

no we’re said increased was great 20

more years so now the minimum life

expectancy when I would have been where

the world were 2013 anywhere in the

world was close to 50 years which is

great and also the maximum now is

clumsy’ four years which is almost buds

is over ten years different so no around

the world most people ladies max

countries living ten more years in

averages great news

these are improving so let’s merge pairs

of D different code and I know it

oh I’ve got my code console here ok

sometimes I cry clicking here

back up it’s a paste code so there’s the

2013 Mariners point yeah 1916 in 2013

all right so you know check the

structures again just to make sure

nothing

wonky happened course factor country

name is a factor

we should factor eight years integer we

could change that to a factor since

we’re not doing they ever suspect you’re

anything with these numbers but we don’t

wear the needs out

because we’re going to cuz it we

separated them so you just drop those

most make sure 2013 was good yeah under

nieces observations of six pair cosigner

Asics serrations in our observations are

rows and yeah like you’re gonna think of

Excel or so our regular spreadsheet our

matrix these are number of rows upper

and are the variables would be columns

versus variables and you don’t need

those years so we can drop them so

nothing LT happens I don’t take space

and capitation Tunney just in case

happens so this is easy waiting artex

dropper me trace column just make it an

Austin doll you know just their by them

it looks like now ya know be able to

fight variables do 2013 and yeah there

are factors in our tombs Chilean like

respect to single even numbers to see

supply dude

there was potential and actually now we

will now we’ll do the visualization

creating graphs so it’s easy to see

changes there to the two years well

unload GG clock stops when it moves

today and now all visualize the date

1960 dataset okay so I will make this

larger here see some point of

visualization to see tendencies when is

that going to other okay so these are

just preset parameters I used but we can

change that baggage which is well let’s

change that II and she looks like again

okay that’s easy to see them all now I’m

gonna see what see if that does alright

so they’re a lot bigger now but they

heirs it with 200 laps is hard to see

like here’s a glob countries so much

let’s change the making less choice bare

hands

here’s the transparency so we’ll see

that’s easier to see the law here

yeah you guys the difference in

Bennett’s looks very famous that’s a

pretty useful especially appear in a

presentation and people at the back of

the room it’s gonna go up to their chest

make them lower the transparency make

them will take color just makes a big

glob yeah Club it so elected six that I

started with and I think we go back to I

think eight for the size you can still

see them come far away

and there’s about touch of a big glob

there big mess so so here’s an agency

you can see here’s the max there’s

countries that have been over 70 years

less respected at birth and here’s the

Tildy raped here’s some one country over

heat there’s another one around each

children per female I believe and

there’s very few less than four most of

my blower for I have four kids that’s

why it’s interesting the people are

shocked by that because it’s not the

trend any more of those trend back in

the day so objects more recent years

2013 don’t let’s change the size of

these circles to age see the easier all

right yes even a huge mafioso you can

see like in Europe and America’s most

people are having less than four kids

now under 0 to 2 so that’s why you’re

surprised medical kids but hush the way

things worked out and very few crunching

end up interested over eight as before

very few them have over six let’s go

back to

it’s the size 5 that’s some occasion in

the back between yeah 969 2013 c2 Leary

in Oceania all the countries are moving

this way

most of now under for life expectancy

you look at that as well so yeah here’s

when I was booked 28 to 29 years a

couple around 30 a bunch around 40 years

so at Birth you expected it’s about 40

its countries in here it’s all the

European countries yeah this is yeah

these are those different countries and

here’s the Americas so look you know

2013 they’re all the European countries

of the way over here there’s only one of

them understand years and a lot of the

Asian countries now also but 65 there’s

one here but most most countries I’m a

65 year or greater life expectancy in

Asia and Oceania as well there’s only

one here under 65 few African countries

that are 60 but the lowest here again

either her own 50 which is a huge

difference from here were in law than

were ever off 13 a whole bunch of

countries here on 40 so it’s great that

that respects yes

she ain’t John is the maximum to more

people are expected to live longer but

the minimum sum was expect to live now

it’s a lot higher which is great news a

lot of advancements in resources and

health and science and information

practices or

presentation and ventilation and

nutrition so in theirs

oh this is children yeah there’s a

couple of Asian countries are still here

we can see let’s go from here huge shift

of having lots of kids and low life

expectancy to now having fewer kids and

higher after life expectancy and this is

also the birth rate is also interesting

because there’s a lot of panic the

gospel decade especially knows it’s got

a news 90s era was dawning Gorgo

overpopulation which is still

potentially an issue but it’s curved

lines just by the over Tilly right so we

seem to invest in more more investment

per child in the past between folks more

education and technology expanding kids

to device technology faster so more

dependent on kids then we were in the

past think there’s anything I was

interested you know here’s one European

country and then life expectancy of 45

it son Louis

yeah there’s no more here at paint

countries yeah here’s the lowest now as

opposed to say so thank you for watching

my video please like share subscribe and

comment also if you want contact me you

go to my website datacite Singh Kham by

the contact information form or you can

email me at Peter thermal at data

science and calm that my last name is

tho koe de L thank you goodbye

Likert Scales in Tableau

If you need help with Using R, I’m Peter Koebel the owner of Data Sciencing Consultants. You can reach me at 204-770-6437, or email me at peter.koebel@datasciencing.com, or fill out the form on our website https://datasciencing.com.  You can also check out our YouTube channel for more awesome Excel tips!

For more awesome python and machine learning tips, like this one about Using R, check out the Datasciencing Consultants blog.

Looking for more fun with data? You might enjoy some of our other posts!

US Population Density Map using Tableau

https://www.youtube.com/watch?v=tZcrQsT8HMM&ab_channel=datasciencing Join our founder, Peter Koebel as he demonstrates a population density map using Tableau. You've probably seen population density visualizations everywhere, but how can you use them in your own...

Datasciencing Customer Demographics with Power BI

https://www.youtube.com/watch?v=t7GkRwIRqQI&t=152s&ab_channel=datasciencing Join our founder, Peter Koebel, as he walks through datasciencing customer demographics with Power BI. Datasciencing can be tough, but does it have to be? Check out this demonstration...