Skip to content

Commit

Permalink
version 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Pankaj Das authored and cran-robot committed Aug 11, 2023
0 parents commit ea83b6b
Show file tree
Hide file tree
Showing 11 changed files with 281 additions and 0 deletions.
13 changes: 13 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Package: HealthCal
Type: Package
Title: Health Calculator
Version: 0.1.0
Author: Pankaj Das [aut, cre]
Maintainer: Pankaj Das <pankaj.das2@icar.gov.in>
Description: Health Calculator helps to find different parameters like basal metabolic rate, body mass index etc. related to fitness and health of a person.
License: GPL-3
Encoding: UTF-8
NeedsCompilation: no
Packaged: 2023-08-10 12:15:40 UTC; Pankaj
Repository: CRAN
Date/Publication: 2023-08-11 12:23:46 UTC
10 changes: 10 additions & 0 deletions MD5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
e3d9cd210c69617f21030c3c16d0c963 *DESCRIPTION
df390c53434517b304ac5db487184641 *NAMESPACE
14ff590b823f406bc456744ac2f78012 *R/BFPF.R
fcd242bd9484a36820db966851b0bc78 *R/BFPM.R
403c55361b7938ca21cb84b815fdb7fb *R/BMI.R
fee2977f5633461624eb4649adc8852b *R/BMR.R
524837206e319a0ccba1da7b84db9e8b *man/BFPF.Rd
870c4a87fa1a00e1c8c95e1abba14a00 *man/BFPM.Rd
71a69af8cdd4336520981e0040abb549 *man/BMI.Rd
8d4fc6232aab5398802629bf86070029 *man/BMR.Rd
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exportPattern("^[[:alpha:]]+")
34 changes: 34 additions & 0 deletions R/BFPF.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
BFPF=function(inputdata){
height<- inputdata[1]#in unit of cm
weight <- inputdata[2]#in unit of kg
age <- inputdata[3]# in ubit of year
h <- 0.01*height
BMI=(weight/h^2)
BFI_F= (1.20 * BMI) + (0.23 * age) - 5.4
BFI_M= (1.20 * BMI) + (0.23 * age) - 16.2

if(BFI_F <10) {
BFI_d= (1.20 * BMI) + (0.23 * age) - 5.4
return(paste0(" The Body Fat Percentage (BFP) is ",
format(round(BFI_d, 2), nsmall = 2), " % and You are extremely low fat level catagory." ))
}
else if(BFI_F >31) {
BFI_o=(1.20 * BMI) + (0.23 * age) - 5.4
return(paste0(" The Body Fat Percentage (BFP) is ",
format(round(BFI_o, 2), nsmall = 2), " % and You are Obese catagory."))
}
else if(BFI_F <=10 & BFI_F>=13 ) {
BFI_e= (1.20 * BMI) + (0.23 * age) - 5.4
return(paste0(" The Body Fat Percentage (BFP) is ",
format(round(BFI_e, 2), nsmall = 2), " % and You are essential catagory." ))
}
else if(BFI_F >= 25 & BFI_F<=31) {
BFI_av=(1.20 * BMI) + (0.23 * age) - 5.4
return(paste0(" The Body Fat Percentage (BFP) is " ,
format(round(BFI_av, 2), nsmall = 2), " % and You are average catagory."))
}
else #BFI_F = 14:24 case
BFI_Fit=(1.20 * BMI) + (0.23 * age) - 5.4
return(paste0(" You are fit. The Body Fat Percentage (BFP) is ",
format(round(BFI_Fit, 2), nsmall = 2), " % . If your BF are in range of 14-20%, you are atheletic. "))
}
39 changes: 39 additions & 0 deletions R/BFPM.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#body fat percentage calculation

BFPM=function(inputdata){
height<- inputdata[1]#in unit of cm
weight <- inputdata[2]#in unit of kg
age <- inputdata[3]# in ubit of year
h <- 0.01*height
BMI=(weight/h^2)
#BFI_F= (1.20 * BMI) + (0.23 * age) - 5.4
BFI_M= (1.20 * BMI) + (0.23 * age) - 16.2
#return(paste0(" The Body Fat Percentage (BFP) for Male is ",
#format(round(BFI_M, 2), nsmall = 2), " % ",
# " and for female is ", format(round(BFI_F, 2), nsmall = 2), " %. " ))

if(BFI_M <2) {
BFI_d= (1.20 * BMI) + (0.23 * age) - 16.2
return(paste0(" The Body Fat Percentage (BFP) is ",
format(round(BFI_d, 2), nsmall = 2), " % and You are extremely low fat level catagory." ))
}
else if(BFI_M >25) {
BFI_o=(1.20 * BMI) + (0.23 * age) - 16.2
return(paste0(" The Body Fat Percentage (BFP) is ",
format(round(BFI_o, 2), nsmall = 2), " % and You are Obese catagory."))
}
else if(BFI_M <=6 & BFI_M>=2 ) {
BFI_e= (1.20 * BMI) + (0.23 * age) - 16.2
return(paste0(" The Body Fat Percentage (BFP) is ",
format(round(BFI_e, 2), nsmall = 2), " % and You are essential catagory." ))
}
else if(BFI_M >= 18 & BFI_M<=24) {
BFI_av=(1.20 * BMI) + (0.23 * age) - 16.2
return(paste0(" The Body Fat Percentage (BFP) is " ,
format(round(BFI_av, 2), nsmall = 2), " % and You are average catagory."))
}
else #BFI_M = 6:17 case
BFI_Fit=(1.20 * BMI) + (0.23 * age) - 16.2
return(paste0(" You are fit. The Body Fat Percentage (BFP) is ",
format(round(BFI_Fit, 2), nsmall = 2), " % . If your BF are in range of 6-13%, you are atheletic. "))
}
22 changes: 22 additions & 0 deletions R/BMI.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#BMI calculation

BMI=function(inputdata){
height<- inputdata[1]#in unit of cm
weight <- inputdata[2]#in unit of kg
h <- 0.01*height
BMI=(weight/h^2)
if(BMI> 25) {
BMI_over=(weight/h^2)
return(paste0("The Body Mass Index (BMI) is ",
format(round(BMI_over, 2), nsmall = 2), " kg/m^2 and You are overweight." ))
}
else if(BMI < 18.5) {
BMI_under=(weight/h^2)
return(paste0("The Body Mass Index (BMI) is ",
format(round(BMI_under, 2), nsmall = 2), " kg/m^2 and You are underweight."))
}
else #BMI = 18.5:25 case
BMI_N=(weight/h^2)
return(paste0("You are Normal. The Body Mass Index (BMI) is ",
format(round(BMI_N, 2), nsmall = 2), " kg/m^2 "))
}
13 changes: 13 additions & 0 deletions R/BMR.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#BMR calculation
#BMR=(10*Weight_Kg)+(6.25*height_cm)-(5*age_years)+5
#BMR=(10*Weight_Kg)+(6.25*height_cm)-(5*age_years)-161
BMR=function(inputdata){
H<- inputdata[1]#in unit of cm
W <- inputdata[2]#in unit of kg
A<-inputdata[3]#in unit of years
BMR_Female=(10*W)+(6.25*H)-(5*A)-61
BMR_Male=(10*W)+(6.25*H)-(5*A)+ 5
return(paste0(" The Basal Metabolic Rate (BMR) for Male is ",
format(round(BMR_Male, 2), nsmall = 2), " calories/day. ",
" and for female is ", format(round(BMR_Female, 2), nsmall = 2), " calories/day. " ))
}
36 changes: 36 additions & 0 deletions man/BFPF.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
\name{BFPF}
\alias{BFPF}
\title{
Body Fat Percentage (BFP) for female
}
\description{
The BFPF function helps to calculate Body Fat Percentage (BFP) for female.
}
\usage{
BFPF(inputdata)
}
\arguments{
\item{inputdata}{
Input data that includes height, weight and age of a female
}
}
\details{
BThe body fat percentage (BFP) of a human or other living being is the total mass of fat divided by total body mass, multiplied by 100; body fat includes essential body fat and storage body fat. Essential body fat is necessary to maintain life and reproductive functions. The equation for BFP calculation was developed at the Naval Health Research Center (NHRC), in San Diego, California. The function was created using this equation. The body fat percentage is a measure of fitness level, since it is the only body measurement which directly calculates a person's relative body composition without regard to height or weight.The percentage of essential body fat for women is greater than that for men, due to the demands of childbearing and other hormonal functions.
}
\value{ It returns body fat percentage (BFP) for female with present catagory}
\author{ Pankaj Das}
\references{
Deurenberg, P., Weststrate, J.A., Seidell, J.C. (1991). Body mass index as a measure of body fatness: age- and sex-specific prediction formulas. The British Journal of Nutrition, 65 (2): 105-114.
(doi:10.1079/BJN19910073).
}
\seealso{
BFPF, HealthCal
}
\examples{
dataset47=c(175,90,25)
BFPF(dataset47)
}
\keyword{BFPF}
\keyword{HealthCal}
37 changes: 37 additions & 0 deletions man/BFPM.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
\name{BFPM}
\alias{BFPM}
\title{
Body Fat Percentage (BFP) for Male
}
\description{
The BFPM function helps to calculate Body Fat Percentage (BFP) for Male.
}
\usage{
BFPM(inputdata)
}
\arguments{
\item{inputdata}{
Input data that includes height, weight and age of a male
}
}
\details{
BThe body fat percentage (BFP) of a human or other living being is the total mass of fat divided by total body mass, multiplied by 100; body fat includes essential body fat and storage body fat. Essential body fat is necessary to maintain life and reproductive functions. The equation for BFP calculation was developed at the Naval Health Research Center (NHRC), in San Diego, California. The function was created using this equation. The body fat percentage is a measure of fitness level, since it is the only body measurement which directly calculates a person's relative body composition without regard to height or weight.
}
\value{ It returns body fat percentage (BFP) for Male with present catagory}
\author{Pankaj Das}
\references{
Deurenberg, P., Weststrate, J.A., Seidell, J.C. (1991). Body mass index as a measure of body fatness: age- and sex-specific prediction formulas. The British Journal of Nutrition, 65 (2): 105-114.
(doi:10.1079/BJN19910073).
}
\seealso{
BFPM, HealthCal
}
\examples{
dataset46=c(175,90,25)
BFPM(dataset46)
}
\keyword{BFPM}
\keyword{HealthCal}
39 changes: 39 additions & 0 deletions man/BMI.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
\name{BMI}
\alias{BMI}
\title{
The Body Mass Index (BMI)
}
\description{
The BMI function helps to calculate BMI value and corresponding weight status while taking age into consideration. It help decide whether people are overweight or underweight for over 100 years.
}
\usage{
BMI(inputdata)
}
\arguments{
\item{inputdata}{
Input data that includes height and weight of a person
}
}

\details{
The body mass index (BMI) is a measurement based on a person's mass (weight) and height. The BMI is calculated by dividing the body weight by the square of the height, and it is expressed in kilogrammes per square metre (kg/m2) since weight is measured in kilogrammes and height is measured in metres. The function was created using formula given by Keys et al. (1972).
}
\value{It returns body mass index (BMI) with present status}
\author{Pankaj Das}
\references{
Keys, A., Fidanza, F., Karvonen, M.J., Kimura, N. and Taylor, H.L. ( 1972). Indices of relative weight and obesity. Journal of Chronic Diseases. 25(6): 329–343.
(doi:10.1016/0021-9681(72)90027-6).
}
\seealso{
BMI, HealthCal
}
\examples{
dataset44=c(175,90)
BMI(dataset44)
}
\keyword{BMI}
\keyword{HealthCal}
37 changes: 37 additions & 0 deletions man/BMR.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
\name{BMR}
\alias{BMR}
\title{
The Body Mass Index (BMR)
}
\description{
The BMR function helps to calculate rate of energy expenditure per unit time of a person (Male/Female)
}
\usage{
BMR(inputdata)
}
\arguments{
\item{inputdata}{
Input data that includes height, weight and age of a person (male/female)
}
}
\details{
Basal metabolic rate (BMR) is the rate of energy expenditure per unit time by endothermic animals at rest. The basal metabolic rate (BMR) of a person can be calculated using the Harris-Benedict equation, also known as the Harris-Benedict principle (1918). The function was created using this Harris-Benedict principle.The amount that should be consumed each day in kilocalories to maintain one's present weight can be calculated by multiplying the predicted BMR value by a factor that reflects the person's level of activity.
}
\value{It returns basal metabolic rate (BMR) with present status for both male and female}

\author{Pankaj Das}

\references{
Harris, J.A. and Benedict, F.G. (1918). A Biometric Study of Human Basal Metabolism. Proceedings of the National Academy of Sciences of the United States of America. 4 (12): 3703.
(doi:10.1073/pnas.4.12.370).
}

\seealso{
BMR, HealthCal
}
\examples{
dataset45=c(175,90,25)
BMI(dataset45)
}
\keyword{BMR}
\keyword{HealthCal}

0 comments on commit ea83b6b

Please sign in to comment.