Pages

Friday, November 30, 2012

Data types part 4: Logical class


First, an update:  A commentator has asked me to post my code so that it is easier to practice the examples I show here.  It will take me a little bit of time to get all of my code for past posts well-documented and readable, but I have uploaded the code and data for the last 4 posts, including this one, here:

Code and Data download site

Unfortunately, I could not find a way to attach it to blogger, so sorry for the extra step.
_________________________________________________________________________

Ok, now on to Data types part 4: Logical

I started this series of posts on data types by saying that when you have a dataframe like this called mydata:




you can't do this in R:

Age<25

Because Age does not exist as an object in R, and you get the error below:





But then what happens when I do,

mydata$Age<25

This is perfectly legal to do in R, but it's not going to drop observations. With this kind of statement, you are asking R to evaluate the logical question "Is it true that mydata$Age is less than 25?".  Well, that depends on which element of the Age vector, of course. Which is why this is what you get when you run that code:



On first glance, this looks like a character vector.  There is a string of entries using character letters after all.  But it's not character class, it's the logical class.  If you save this string of TRUE and FALSE entries into an object and print its class, this is what you get:



The logical class can only take on two values, TRUE or FALSE.  We've seen evaluations of logical operations already, first in subsetting, like this:

mysubset<-mydata[mydata$Age<40,]

Check out my post on subsetting if this syntax is confusing. In a nutshell, R evaluates all rows and keeps only those that meet the criteria, which is only rows where Age has a value of under 40 and all columns.

Or here, in ifelse() statements

mydata$Young<-ifelse(mydata$Age<25,1,0)

More on ifelse() statements here. The ifelse() function is really useful, but is actually overkill when you're just creating a binary variable. This can be done faster by taking advantage of the fact that logical values of TRUE always have a numeric value of 1, while logical values of FALSE always have a numeric value of 0.

That means all I need to do to create a binary variable of under age 25 is to convert my logical mydata$Ageunder25 vector into numeric.  This is very easy with R's as.numeric() function. I do it like this:

mydata$Ageunder25_num<-as.numeric(mydata$Ageunder25)

or directly without that intermediate step like this:

mydata$Ageunder25_num<-as.numeric(mydata$Age<25)

Let's check out the relevant columns in our dataframe:


We can see that the Ageunder25_num variable is an indicator of whether the Age variable is under 25.

Now the really, really useful part of this is that you can use this feature to turn on and off a variable depending on its value. For example, say you got your data and realized that some of the height values were in inches and some were in centimeters, like this:



Those heights of 152 and 170 are in centimeters while everything else is inches.  There are various ways to fix it, but one way is to check which values are less than, say 90, which is probably a safe cutoff and create a new column that keeps those values under 90 but converts the values over 90.  We can do this in this way:


mydata$Height_fixed_in<-  as.numeric(mydata$Height_wrong<90)*mydata$Height_wrong 
+ as.numeric(mydata$Height_wrong>=90)*mydata$Height_wrong/2.54

So the first half of the calculation (in red) is "turned on" when Height_wrong is less than 90, because the value of the logical statement is a numeric TRUE, i.e. a 1, and this value of 1 is multiplied by the original Height column.  The second part of the statement (in blue) is FALSE and so is just 0 times something so it's 0.  If the Height_wrong column is greater than 90, then the first half is just 0 and the second half  is turned on and thus the Height_wrong variable is divided by 2.54 cm, converting it into inches. We get the result below:



Another useful way to use the as.numeric() and logical classes to your advantage is a situation like this:


I have in my dataset the age of the last child born (and probably other characteristics of this child not shown), and then just the number of other children for each woman.  I want to get a total number of children variable.  I can do it simply in the following way. 

First, a note about the is.na() function.  If you want to check if a variable is missing in R, you don't use syntax like "if variable==NA" or "if variable==.".  This is not going to indicate a missing value. What you want to use instead is is.na(variable) like this:

is.na(newdata$Child1age)

Which gives you a logical vector that looks like this:





If you want to check if a variable is not missing, you use the ! sign (meaning "Not") in front and check it like this:





We've seen this kind of thing before!  Now we can translate this logical vector into numeric and add it to the number of other children, like this:

newdata$Totalnumchildren<-as.numeric(!is.na(newdata$Child1age))+newdata$Numotherchildren

We get the following:


If we want to get those NAs to be 0, we can again use the is.na() function and replace whereever Totalnumchildren is missing with a 0 like this:

newdata$Totalnumchildren[is.na(newdata$Totalnumchildren)]<-0






Wednesday, November 28, 2012

Living With Diabetes Comfortably

Living with diabetes can become comfortable or remain a source of constant worry, depending how you approach the issue. Any form of stress or worry can, in turn, cause your sugar levels to fluctuate, so getting things under comfortable control is obviously your main aim.

http://kampoengtahes.blogspot.com/
Timing and a regular routine are everything, particularly if you take diabetic medication, which tends to rule the body as much as your food intake. If forming a regular routine seems impossible to someone young and spontaneous, persuade him or her to try it for a month. The benefits can be felt within a few days, as the body adjusts.

Carrying glucose sweets (as is recommended) to ward off unexpected sugar lows can just as easily start sudden swings in sugar levels. An apple, a wedge of cheese or about 15 almonds, eaten before the danger signs become obvious, could be more helpful than resorting to high-sugar pick-me-ups.

Eating small amounts at two- to three-hourly intervals is recommended, which should reduce meal sizes considerably, but ensure mid-morning and mid-afternoon snacks are eaten. Don't confuse the word 'snacks' with processed packet junk food.

Regular exercise is still the best way to lower sugar levels. Diabetics benefit most from some exercise at the same time daily rather than more, less often. It all goes back to routine, diet and medication.

A combination of meds and exercise could drop you quickly to a difficult place, so it's wise to take the time to find out what suits you best. Beware the sun (which reacts with some medication); carry water, wear a medical alert bracelet and don't push yourself too hard.

But regular exercise also promotes weight loss, general fitness, lowers overall blood pressure and reduces stress, releasing the natural endorphins that make life seem more fun.

Moving directly from exercise to a formal business appointment can really throw you out, especially if the meeting runs late and you need to drive afterwards. When your blood-sugar levels are too low, you should not be behind the wheel of a car.

It's also not really a good time to be using crowded public transport or walking a long distance, so if you move around a lot independently, munch an apple or a couple of raw carrots if necessary and always wear a medical alert bracelet.

Good planning can make living with diabetes a far more comfortable experience. And if you have been recently diagnosed, the benefits to your health once a good routine is established will make you want to jump for joy.

Monday, November 26, 2012

The Limits of Vegan Consumption

Juan Karita / AP
When you transform a food into a commodity, there's inevitable breakdown in social relations and high environmental cost - Tanya Kerssen



Quinoa
A gluten-,soy-, GMO-free, complete plant protein. Half of the world's quinoa export comes from Bolivia, where 90% of the crop is grown organically, mostly on small family farms, and where growers' unions protect their livelihoods from the appropriation by multinational corporations. Beyond being an allergen-free, fairly traded, nutritional powerhouse, the increase in demand on the global market is funneling wealth into one of the poorest regions in South America. Families are being able to purchase new technologies that can reduce the stress and increase the efficiency of their farms as well as afford to send their children to university. Superfood indeed!

As successful as quinoa has become as a replacement for grains and a go-to answer to "where do you get your protein?," its success is beginning to come at a cost to indigenous ecological and cultural sustainability. In a Time article published earlier this year, Jean Friedman-Rudovsky reported a breakdown in community, "the traditional relationship between llama herding and soil fertilization," and children's SOLE food consumption.

With its entrance into the global market, quinoa has become a force of globalization. Globalization isn't merely a process that attracts wealth, it's also a process that creates an entry for western culture and technology--the good, the bad, and the ugly. The expanse and intensification of quinoa on the Andean high plains disrupts the communal grazing land of llama's, a cameloid who nourishes the harsh earth with their nitrogen-rich guano. Farmers are now competing to establish plot ownership over what has for millenia been 90% communal grazing land, with the result of seasonal kidnappings and violence as well as an increase in soil erosion and use of finite water sources. The rising affluence from the crop also leads to access to media and food once unavailable, corresponding to a change in food preferences away from the indigenous crop toward processed, malnutritious commodities. Further, the tripling of quinoa's market value may make this once local, nutritious, "mother grain" less accessible to locals not directly reaping the economic benefits.*

(Quinoa is of the most benign "cruelty-free" foods when compared to palm oil and chocolate)


"Beyond Veganism"
These less than ideal consequences that trail the otherwise mutual benefits of the global consumption of quinoa is no reason to cut the crop out of vegan diets, but it does offer an opportunity to reflect upon the limits of a consumption-centered vegan ethic (a discourse primarily about what we eat and don't eat rather than the restoration of the social responsibility we feel with all sentient beings).

While the institutional killing of chickens in the US and llamas in Bolivia go against vegan values, so perhaps too does the undercutting of food sovereignty and and biocultural diversity. There is no need to conclude that US vegans ought to condemn international food ways, nor should they finger-wag at the desire of people in the global South to share in modern technologies and western culture. What is important is to be critically engaged with the real impact our lives have on (human and animal) others, to understand that foods do not fit naturally and firmly into categories such as "good" and "bad."

The just production, distribution and consumption of certain foods vary by the methods, the place, and the time for each food. For instance, rice may a have smaller water-footprint when grown in southeast Asia and a than in California; the carbon-footprint may be higher for growing tomatoes in a local greenhouse than on a farm in Florida, but Florida tomatoes may be picked by wage slaves; people living in tundra and desert often depend upon the exploitation and killing of animal others, but by advocating an animal-free diet would force them into dependency on expensive and/or malnutritious outside food and undermine their food sovereignty. In the case of quinoa, a internationally-desired food that at first provided great benefits to Andean farmers may turn into a food that comes at the expense of the local ecology and culture.

Food is complex. General rules (like eat vegan, seasonal/local, fair, permacultural, and organic food) are important for keeping us sane, productive people. But not everyone has the privilege of living in a California vegan cooperative where SOLE food is accessible and abundant year-round. If you live in a food desert or an isolated part of the world unconductive to sustainable agriculture, one is institutionally constrained into prioritizing certain food values over others (such as cost-effectively meeting one's caloric needs with non-toxic food). Rather than simply asking those with less privilege to work towards a vegan practice, vegans can work in solidarity with other people to transforming present food systems away from not only a species hierarchy, but also class, gender, race, and national hierarchy as well. As I wrote before, "[v]eganism will have limited success so long as it remains a luxury reserved for those with privilege, independent of human liberation movements."


Food Empowerment

Read more »

Wednesday, November 21, 2012

3 Tips on Healthy Eating

Nutrition is everything! Your ability to trim down and tone up rises and falls on mastering this one facet of fitness! Your longevity of life is dependent on proper balance of nutritious foods. Discover a few helpful "dos and don'ts" on healthy eating!
  1. Raw Fruits and Veggies. It is obvious to say so, but it must be emphasized...eat your fruits and veggies daily! Researchers report that in order achieve optimum health we ought to consume 10-13 servings of raw fruits and veggies a day. This is certainly quite a task for the average American considering they are hard pressed to consume even 1 serving a day a raw fruits and veggies. Don't be discouraged or overwhelmed. You don't have to take on this task over night. Work your way up to the recommended amount gradually by starting with 2 fruits and 2 veggies (4 total) servings per day. Once that becomes a simple habit then increase to 3 and 3 (6 total), and continue until you get a total of 10-13 total servings.

  2. Food Log. In order to fully grasp and visualize your nutrition habits you must start writing down what you eat during the day and review it at the end of the day. As a fitness coach, I periodically require my clients to send me an e mail every day of their nutrition for that day. It's incredible to see the change they make in their lives by simply seeing what they stuff into their faces every day. Nutrition logging is vital to the weight loss and fat loss process. You must keep track of it in order to reach your God-given fitness potential. Not keeping track of your nutrition is like trying to succeed in business yet neglecting to keep good records of finances and clients. Be a wise steward of your body and avoid fast foods; replace them with raw fruits and veggies....and lots of it!

  3. Supplementation. Along with maintaining the proper nutrition plan, we must also consider supplementing our diet with good healthy, clean, able to be absorbed nutrition supplements. Notice I am not using the word "vitamin". Vitamins are not whole foods, typically. We want whole food type supplements. We want them to be as natural and "organic" as possible (not processed). My recommendations for supplements to the general public would include a good protein powder, fish oil, vitamins D and A and C. You will most likely not find these items in pure, clean forms at your local nutrition shops or grocery stores. You also most likely will not find it at your medical doctor's office. So, you will most likely need to search for nutritionists or chiropractors or holistic doctors/nurses or midwives in your area. There are some grocery stores or whole food stores that are a breath of fresh air when it comes to finding what I'm talking about. Some of you reading this may need to purchase your products online. No matter what, do your research on anything you put into your body for food!
CAVEAT: I am not a doctor or dietician. This article is not intended to give specific nutritional advice to any particular person. These statements may not be applicable to everyone. You must contact your doctor or nutritionist and perform your own well thought out research before taking on any new diet plans or supplements.

Rex Causey holds a Bachelor degree in Exercise Science (Physical Education) and minored in athletic coaching and biblical studies. He is a certified strength and conditioning coach and has been a personal trainer/nutrition counselor/strength coach for 7 years, while also teaching and coaching various sports during that time.

Rex is married with two children and enjoys basketball, good food, power lifting, and spending time with his family. He is a resident of Shenandoah in The Woodlands, Texas.

Data types, part 3: Factors!


In this third part of the data types series, I'll go an important class that I skipped over so far: factors.

Factors are categorical variables that are super useful in summary statistics, plots, and regressions. They basically act like dummy variables that R codes for you.  So, let's start off with some data:



and let's check out what kinds of variables we have:


so we see that Race is a factor variable with three levels.  I can see all the levels this way:


So what his means that R groups statistics by these levels.  Internally, R stores the integer values 1, 2, and 3, and maps the character strings (in alphabetical order, unless I reorder) to these values, i.e. 1=Black, 2=Hispanic, and 3=White.  Now if I were to do a summary of this variable, it shows me the counts for each category, as below.  R won't let me do a mean or any other statistic of a factor variable other than a count, so keep that in mind. But you can always change your factor to be numeric, which I'll go over next week.






If I do a plot of age on race, I get a boxplot from the normal plot command since that is what makes sense for a categorical variable:

plot(mydata$Age~mydata$Race, xlab="Race", ylab="Age", main="Boxplots of Age by Race")

Finally, if I do a regression of age on race, notice how I instantly get dummy variables:

summary(lm(Age~Race, data=mydata))











Here Black is the reference category since it's the first level by alphabetical order.







What if I want to run the same regression as before, but I want to use Hispanic as my reference group?  Very easily, I just relevel the factor like this and get the resulting regression output:

mydata$Race2<-relevel(mydata$Race, "Hispanic")

summary(lm(Age~Race2, data=mydata))










Notice how now the Hispanic category is the reference.




So that is great stuff. But it's really important to know how to manipulate the factor variables. First, I can create factors using the factor() function.  I notice from viewing my dataset above (or from running class(mydata$Marriage)) that marriage is numeric and coded as 0, 1, or 2.  I find out in my codebook that those values correspond to Single, Married, and Divorced/Widowed. We can fix that this way:

mydata$Married.cat<-factor(mydata$Married, labels=c("Single", "Married", "Divorced/Widowed"))

This will create an unordered factor where 1=Single, 2=Married, and 3=Divorced/Widowed.

Now let's say I want to create a variable that describes whether someone's weight is "Low", "Medium", and "High".  In this case, I'll use the cut() function, which instantly creates a factor that I can label, then I use the ordered() function around the cut function to order the levels.  I show it in different colors for ease of viewing the two functions that I'm nesting:

mydata$Weight.type<-ordered(cut(mydata$Weight, c(0,135,165,200), labels=c("Low", "Medium", "High")))


If I print out the class and the contents of the variable (left) , I notice that it's an ordered factor and it tells me that Low<Medium< High, which is what I want.

We can see the new additions to my dataset (I'm showing just the relevant columns):




One caveat with factors - if you start off with a level and then you drop the only observations with that level, R still holds on to the level as a stored value and this can mess up your later analysis.  For example, I subset my data to the first 6 rows so that I eliminate all Hispanic subjects from my data, but R keeps Hispanic as a possible level:


mynewdata<-mydata[1:6,]
summary(mynewdata$Race)






So here Hispanic just has a 0 count, but is still a category.  This can be really annoying, like when you're making a barplot and the category is still showing up in the plot.

One quick way to get rid of this is to use the droplevels() function to drop all unused levels from your dataset. A commentator let me know that this function was introduced in R 2.12.0. Before, it was necessary to use a separate package called gdata. The function takes the whole dataframe as the argument, and you can use the except argument to list the indices of columns that you do not want subject to the dropping:

finaldata<-droplevels(mynewdata)
summary(finaldata$Race)






You could do all this very efficiently in one step like this without changing the name of your dataframe:

mydata<-droplevels(mydata[1:6,])

which is why we love R!

Monday, November 19, 2012

Partnering to Create Healthy Futures

Maine's statewide Community Transformation Grant (CTG) is facilitating partnerships among state and local organizations to implement an evidence-based approach to reduce childhood obesity. Working with state agencies and private programs that care for children, the Maine CTG effort has been able to leverage the expertise of the Let's Go! 5210 Goes to Childcare program and added resources to support healthy eating and active living in childcare programs. Already, more than 230 additional sites are benefiting from the collaborative approach.


Challenge

In 2011, more than 38% of Maine's kindergarten students were overweight or obese. Carrying too much weight as a young child increases the risk of being an overweight or obese adult; increases the risk of having chronic diseases, such as Type 2 diabetes and heart disease; and leads to a poor quality of life. The good news is that with time and attention, the trend can be stopped and even reversed. Healthy eating and physical activity are two behaviors that are known to impact weight. These behaviors are influenced by family, and friends, and access to health options. For our youngest children who spend much of their days with childcare providers, the childcare setting presents an opportunity to set the stage for a lifetime of healthy habits. The challenge is in providing caregivers the assistance they need to foster healthy places and habits for our youngest residents.

Solution

Maine’s Community Transformation Grant is leveraging limited resources through public-private partnerships and multiple collaborations to address childhood obesity. The approach uses a structured, evidenced process, Let’s Go! 5210 Goes to Childcare or Let’s Move, to help licensed child care providers identify and implement more supports in their programs for healthy eating and active living. Through education and guidance, providers will adopt practices that foster healthy lifestyle choices for Maine’s most vulnerable, our children.

Results

Maine's CTG has built on the strengths and skills of the Statewide Childhood Obesity Taskforce partners to create and implement common approaches and tools to support healthier childcare environments. Maine's nine public health districts have created plans and started implementation of the structured process with their local licensed childcare providers and local Let's Go! 5210 Goes to Childcare partners. In the first year with the help of CTG, more than 230 additional licensed childcare sites have enrolled with Let's Go! 5210 Goes to Childcare to begin the change process.

Future Directions

This is an opportunity for licensed childcare providers and supporting agencies to benefit from technical assistance and resources to promote healthy eating and active living in your communities. The ultimate goal is to create a healthy start for our youngest residents by surrounding them with healthy environments and promoting habits that prevent obesity. By 2016, we expect to see one-third of Maine's licensed childcare sites make environmental changes to support healthy living. There will be continued strong collaboration across public and private agencies working to address childhood obesity in Maine.

Friday, November 16, 2012

Get Smart About Antibiotics

What do sinusitis, most sore throats, bronchitis, runny noses and the regular cold have in common? They are upper respiratory tract infections usually caused by viruses that can′t be cured with antibiotics. Yet, each year, health care providers in the U.S. prescribe tens of millions of antibiotics for viral infections.


To bring attention to this increasing problem, Maine CDC is observing Get Smart About Antibiotics Week this week, along with the Maine Medical Association, Maine Hospital Association, and Maine Public Health Association.

The campaign highlights the coordinated efforts of US CDC, states, and other partners to educate clinicians and the public about antibiotic resistance and the importance of appropriate antibiotic use.

Over-prescribing antibiotics, using a broad-spectrum therapy when a more specific drug would be better, starting and stopping medications, giving leftover medications to a friend who appears to have the same ailment you had, all contribute to the problem of antibiotic drug resistance, according to US CDC. As we enter this year′s cold and flu season, CDC asks parents to not insist on getting antibiotics when a health care provider says they are not needed.

Health care providers are asked to take the time to educate patients about antibiotic resistance and the possibility of having serious side effects. For example, allergic reactions to antibiotics, such as rash and anaphylaxis, send thousands of patients to the emergency room each year, according to a study published in the Clinical Infectious Diseases Journal.

Health care providers can also prevent antimicrobial resistance by ensuring prompt diagnosis and treatment of infections, prescribing antibiotics appropriately, and following infection prevention techniques to prevent the spread of drug-resistant infections in health care facilities. Doctors cite diagnostic uncertainty, time pressure, and patient demand as the primary reasons for their tendency to over-prescribe antibiotics. Appropriate use of existing antibiotics can limit the spread of antibiotic resistance, preserving antibiotics for the future.

For treatment guidelines for Upper Respiratory Tract Infections, see: http://go.usa.gov/YSb5

For more information about antimicrobial resistance, including background articles, patient materials, and continuing education programs, see http://go.usa.gov/YSbV

Thursday, November 15, 2012

Influenza update 11/15/12

Maine CDC recently reported the first flu activity for the 2012-2013 season. For more information and clinical recommendations for this flu season, see the Nov. 5 health alert at http://go.usa.gov/YSTQ

 
Weekly updates on flu activity are available online:
 
 
Maine CDC reminds everyone to take everyday preventive measures against the flu:
  • Wash your hands frequently
  • Cough and sneeze into your elbow or shoulder
  • Stay home when you feel sick
  • Get vaccinated – find locations at www.flu.gov

Monday, November 12, 2012

Protein - Changing the Diet and the Mind of the Strength Training Athlete

Old myths die hard, it would seem. One of the biggest and oldest that surrounds protein is that a strength training athlete needs to eat a lot of protein so that they can get bigger and bigger. This is simply not true, and in fact, too much protein may be dangerous to their efforts. The strength training athlete needs to follow the same diet plan that has long been held by the endurance athlete. Those who are training for improved endurance eat a diet that is higher in carbohydrates, lower in fat and moderate in proteins. The strength athletes tend to eat a diet that is higher in protein and fat and lower in carbohydrates, sticking to the erroneous belief that carbs are the enemy of their efforts.

Digestion and Nutritional Differences

The body digests fat easiest and first. Carbohydrates are digested next and may depend on the type that they are. Simple carbs, such as white bread and white sugars, are fast and easy to digest by the body and can lead to an insulin surge that will lead to increased fat storage. Complex carbohydrates are more slowly absorbed by the body and should be the main source of carbs in the diet. Protein takes the most effort by the body and will be digested last. It is another myth that protein is never stored as fat - it does not matter what the source is, if there are too many calories taken in, the body will store it as fat. Protein, because it takes longer to burn, does keep the body feeling full for longer, which in most cases will allow for smaller meals to be eaten with less overall calories taken in.

The body breaks down food for energy, and in some cases you can actually feel the effort in the form of heat. Each type of nutrient creates heat in the body during digestion, a process referred to as thermogenesis. Meal-induced thermogenesis is around 8% for the average person following a normal diet. Those who are eating a reduced-calorie diet plan may only experience thermogenesis of 4-5%. Fat can increase the thermic effect by 3%, carbs by 10% and protein will cause an increase of around 30%. This effect may be felt for about three hours after the conclusion of the meal.

During a workout, the body turns to carbohydrates for the fuel for the muscles because fat and protein cannot be oxidized fast enough, especially during the demands of a high intensity workout. After the supply of carbohydrates are burned and depleted, the muscles will turn to glycogen for fuel, which is stored by the body as a secondary energy source. If the glycogen stores are full or are not used by the body, the body will simply move carbohydrates to storage as fat. (Source: Quinn 2007)

The experts suggest that the upper limit for protein intake is around 35% of the daily calories, even for the elite athlete. (Source: The American Journal of Clinical Nutrition) Whether you are an athlete or not, you have to make sure that you are getting the right amount of protein, carbohydrates and fat to keep you as healthy and strong as possible.

A Better Athletic Diet Plan

A better concept for the strength training athlete would be to follow the lead of the endurance athlete, which is taking in around 12-15% protein, 25-30% fat and 55-65% carbohydrates. The actual needs of each athlete, weekend warrior or non-athlete are individual and each person must evaluate what does and does not work for them. (Source: Quinn, 2007)

Both the American Heart Association and the American Journal of Clinical Nutrition warn against too much protein for the number of health risks that it may present. Not only does too much protein increase the possibility of a number of diseases and conditions, it can also hurt the performance of the athlete and may not be nearly as beneficial as it has been thought to be.

Too Much Protein

Exceeding the upper recommended limit of protein intake can cause serious problems. It can hurt the performance of the athlete by:

- Depleting the supply of glycogen in the muscles and liver. In addition to serving as stored energy in the muscles, glycogen helps the muscles to retain water.

- Can decrease endurance (you won't be able to work out as long.)
- Can decrease maximum effort (you won't be able to work out as hard.)
- Can severely lower the serum glucose levels, which in turn can lead to hypoglycemia. It is interesting to note that men are less able to tolerate the effects of hypoglycemia than women are.

In addition, too much protein may also cause problems, not only for the athlete but the general public as well:

- It increases the risk of some kinds of cancer.
- Increases calcium excretion, which increases the risk of osteoporosis.
- Keeps the body from absorbing and using some vitamins, minerals, fiber and phytochemicals correctly.

Finally, excess protein may cause problems for people with the following conditions:

- May keep diabetics from keeping their blood sugars leveled out.
- May increase the problems that psoriasis sufferers feel from their condition.
- May cause complications for those with kidney disease, including an increased risk of kidney stones.
- Whey based protein may cause liver damage.
- Some protein supplements may cause allergies.
- An all liquid protein diet increases the risk of gall stones. May cause damage to the pancreas and the spleen.

Protein Supplements

Those who are not getting enough protein based on their needs may consider adding a supplement to their daily food intake. A supplement can be a great way not only to increase protein but to replace less healthy snacks and meals, especially while on the run. People are busier than they have ever been and so many people are not taking the time to eat good foods. Grabbing a protein supplement can keep the eating plan on track by keeping you full for longer and providing you with the energy to power through. It is suggested that if you are going to be exercising at high intensity or for longer than thirty minutes, that you have a protein/carb drink or snack before and after, and of course, make sure that you are staying well hydrated throughout. Good supplement choices include:

- Protein powders, including whey, soy, rice and egg
- Protein shakes
- Protein pudding snacks
- Liquid protein shots
- Protein bars

Read ingredients and make sure that you know exactly what you are getting. Profect, the liquid protein supplement shot from Protica, is made with high quality ingredients and has 25 grams of protein per serving. It is only 100 calories per serving and is available in a number of flavors.

Another option for a pre- or post-workout drink is milk, especially chocolate milk, which has around 9 grams of protein in the average glass and provides 31% of the daily needs of calcium. Chocolate milk, considered to be one of the optimal drinks for the athlete, includes a blend of protein and carbohydrates to help the body with the recovery period, which is important to preventing muscle breakdown. (Source: Marano, 2007)

References

The American Journal of Clinical Nutrition
Hara Estroff Marano The Human Kindness of Milk Psychology Today. December 2007
Elizabeth Quinn High Protein Diets and Sports Performance: Are the Atkins and South Beach Diets a Good Choice for Athletes October 31, 2007

About Protica Research

Founded in 2001, Protica, Inc. is a nutritional research firm specializing in the development of protein-rich, capsulized foods (dense nutrition in compact liquid and food forms). Protica manufactures Profect protein beverage, IsoMetric, Fruitasia and more than 100 other brands in its GMP-certified, 250,000 square foot facility.

Saturday, November 10, 2012

Significance Of Fluoride In Human Nutrition!

http://kampoengtahes.blogspot.com/Fluoride appears to be essential for man. The regular presence of fluoride in minute amounts in human bones and teeth and its influence on the prevention of dental caries justifies its inclusion as an element of importance in human nutrition.

• Most adults ingest between 1 and 3 mg of fluoride daily. The chief source is usually drinking water, which, if it contains 1 part per million of fluoride, will supply 1-2 mg/day.

• Soft waters usually contain no fluoride, whilst very hard waters may contain over 10 part per million compared with this source, the fluoride in foodstuffs is of little importance.

• Very few contain more than I part per million; the exceptions are sea-fish which may contain 5-10 part per million and tea.

• Epidemiological studies in many parts of the world have established that where the natural water supply contains fluoride in amounts of 1 part per million or more, the incidence of dental caries is lower than in comparable areas where the water contains only traces of the element.

• Fluoride becomes deposited in the enamel surface of the developing teeth of children. Such teeth are unusually resistant to caries. It may be that traces of fluoride in the enamel discourage the growth of acid-forming bacteria; alternatively, the calcium hydroxyapatite of the enamel may be rendered more resistant to organic acids by combination with traces of the element. It should be noted that fluoride is not deposited in fully developed adult teeth. So that little benefit to adults can be expected when they begin for the first time to drink water containing traces of fluoride.

• The deliberate addition of traces of fluoride to those public water supplies which are deficient is now a widespread practice throughout North America where about 100 million people are now drinking fluoridated water. In at least 30 other countries similar projects have been started.

• In parts of the world where the water fluoride is high (over 3 to 5 part per million) mottling of the teeth is common. The enamel loses its luster and becomes rough, pigmented and pitted. The effect is purely cosmetic; fluorite teeth are resistant to caries and not usually associated with any evidence of skeletal fluorosis or any impairment of health.

• The main clinical features are referable to the skeleton which shows sclerosis of bone, especially of the spine, pelvis and limbs, and calcification of ligaments and tendinous insertions of muscles.

Thursday, November 8, 2012

Data types part 2: Using classes to your advantage


Last week I talked about objects including scalars, vectors, matrices, dataframes, and lists.  This post will show you how to use the objects (and their corresponding classes) you create in R to your advantage.

First off, it's important to remember that columns of dataframes are vectors.  That is, if I have a dataframe called mydata, the columns mydata$Height and mydata$Weight are vectors. Numeric vectors can be multiplied or added together, squared, added or multiplied by a constant, etc. Operations on vectors are done element by element, meaning here row by row.

First, I read in a file of data, called mydata, using the read.csv() function. I get the dataframe below:


I check the classes of my objects using class(), or all at the same time with ls.str().

class(mydata$Weight)
class(mydata$Height)

or










So I see that mydata is a dataframe and all my columns are numeric (num).  Now, if I want to create a new column in my dataset which calculates BMI, I can do some vector operations:

mydata$BMI<-mydata$Weight/(mydata$Height)^2 * 703


Which is the formula for BMI from weight in pounds and height in inches. Notice how if any component of the calculation is a missing (NA) value, R calculates the BMI as NA as well.

Now I can do summary statistics on my data and store those as a matrix. For example, I start with summary statistics on my Age vector:

summary(mydata$Age)






If I want to extract an element of this summary table, say the minimum, I can do

summary(mydata$Age)[1]

which extracts the first element (of 6) of the summary table.

But what I really want is a summary matrix of a bunch of variables: Age, Sex, and BMI.  To do this I can rowbind the summary statistics of those three variables together using the rbind() function, but only take the 1st, 4th, and 6th elements of the summary table, which as you can see correspond to the Min, Mean, and Max. This creates a matrix, which I call summary.matrix:

summary.matrix<-rbind(summary(mydata$Age)[c(1,4,6)], summary(mydata$BMI)[c(1,4,6)], summary(mydata$Sex)[c(1,4,6)])

Rowbinding is basically stacking rows on top of each other.  I add rownames and then print the class of my summary matrix and the results.

rownames(summary.matrix)<-c("Age", "BMI", "Sex")
class(summary.matrix)
summary.matrix










There is also a much more efficient way of doing this using the apply() function.  Previously I had another post on the apply function, but I find that it takes a lot of examples to get comfortable with so here is another application.

Apply() is a great example of classes because it takes in a dataframe as the first argument (mydata, all rows, but I choose only columns 2, 3, and 7).  I then apply it to the numeric vector columns (MARGIN=2) of this subsetted dataframe, and then for each of those columns I perform the mean and standard deviation, removing the NA's from consideration.  I save this in a matrix I call summary.matrix2.

summary.matrix2<-apply(mydata[,c(2,3,7)], MARGIN=2, FUN=function(x) c(mean(x,na.rm=TRUE), sd(x, na.rm=TRUE)))

I then rename the rows of the this matrix and print the results, rounded to two decimal places.  Notice how the format of the final matrix is different here. Above the rows were the variables and the columns the summary statistics, while here it is reversed.  I could have column binded (cbind() instead of the rbind()) in the first case and I would have gotten the matrix transposed to be like this one.

rownames(summary.matrix2)<-c("Mean", "Stdev")
round(summary.matrix2, 2)







Finally, I want to demonstrate how you can take advantage of scalars and vectors when graphing. Creating scalar and vectors objects is really helpful when you are doing the same task multiple times.  I give the example of creating a bunch of scatterplots.

I want to make a scatterplot for each of three variables (Height, Weight, and BMI) against age.  Since all three scatterplots are going to be very similar, I want to standardize all of my plotting arguments including the range of ages, the plot symbols and the plot colors.  I want to include a vertical line for the mean age and a title for each plot.  The code is below:


##Assign numeric vector for the range of x-axis
agelimit<-c(20,80)

##Assign numeric single scalar to plotsymbols and meanage
plotsymbols<-2
meanage<-mean(mydata$Age)

##Assign single character words to plottype and plotcolor 
plottype<-"p"
plotcolor<-"darkgreen"

##Assign a vector of characters to titletext
titletext<-c("Scatterplot", "vs Age")

Ok, so now that I have all those assigned, I can plot the three plots all together using the following code.  Notice how all the highlighted code is the same in each plot (except for the main title) and I'm using the assigned objects I just created.  The great part about this is that if I decide I actually want to plot color to be red, I can change it in just one place.  You can think about how this would be useful in other situations (data cleaning, regressions, etc) when you do the same thing multiple times and then decide to change one little parameter. If you're not sure about the code below, I posted on the basics of plotting here.

##Plot area is 1 row, 3 columns
par(mfrow=c(1,3))

##Plot all three plots using the assigned objects
plot(mydata$Age, mydata$Height, xlab="Age", ylab="Height", xlim=agelimit,pch=plotsymbols, type=plottype, col=plotcolor, main=paste(titletext[1], "Height", titletext[2]))
abline(v=meanage)

plot(mydata$Age, mydata$Weight, xlab="Age", ylab="Weight", xlim=agelimit,pch=plotsymbols, type=plottype, col=plotcolor, main=paste(titletext[1], "Weight", titletext[2]))
abline(v=meanage)

plot(mydata$Age, mydata$BMI, xlab="Age", ylab="BMI", xlim=agelimit,pch=plotsymbols, type=plottype, col=plotcolor, main=paste(titletext[1], "BMI", titletext[2]))
abline(v=meanage)


Notice how I do the main title with the paste statement.  Paste() is useful for combining words and elements of another variable together into one phrase.  The output looks like this, below.  Pretty nice!










Wednesday, November 7, 2012

Energy in Food

http://kampoengtahes.blogspot.com/South Wales Personal Trainer, gives us the low down on knowing just exactly how much energy is in the food we eat. I Personal Train Cardiff, members of the public at a Cardiff Health club and its amazing how many people do not realise how much energy they are consuming.

Food is an integral and very important part of our life. This is because food is our energy source. Energy needs vary massively between individuals and on a daily basis depending upon a number of factors including daily activity levels and body size. The energy in our diet comes from fat, carbohydrate, protein and alcohol.
Energy in food is represented in calories (Kcal). There are calories in the majority of foods. Fatty foods are high calorie, and foods such as salads and vegetables are very low calorie. In order to loose weight we need to build up a calorie deficit. We need to burn off more calories through physical activity and consume less through food. To gain weight we need to do the reverse (consume more than we burn off).

This does not mean that if we eat 1,500 calories a day you must burn off 1,600 through exercise. This is due to us being able to burn calories while sleeping, sitting down, due to the respiration and heating/cooling down of the body.

The amount of calories (Kcal) we burn throughout the day while doing no physical activity is referred to as our Basal Metabolic Rate or your metabolism. People's Basal Metabolic rate differs from person to person, due to height, weight, body fat and muscle mass.

Therefore to loose weight you must, burn off more calories than you consumes. If this is done over a sustained period weight loss will inevitably follow.

Daily calorie intake

U.K. Dietary reference values for energy. Note: This is an estimated average requirement
Age (years): Males (kcal) - Females (kcal)

19 - 49: 2550 - 1940
50 - 59: 2550 - 1900
60 - 64: 2380 - 1900
65 - 74: 2330 - 1900
75 + 2100 1810

These are often provided to show the average energy requirement of 2000 kcal for women and 2500 kcal for men. Some manufacturers now include this information on food labels.

Now that we can estimate how many calories we should be consuming a day, how do we know exactly how many calories there are in certain foods.

The amount of energy (kcal) in foods varies significantly. As can be seen from the table below; fat and alcohol contain significantly more energy per gram than protein and carbohydrate.

Nutrient kcals/g
Carbohydrate 4
Fat 9
Protein 4
Alcohol 7

Energy in food is measured in calories. A calorie is the amount of energy needed to heat a litre of water by one degree Celsius. Calories are important in terms of weight management. Weight gain is due to a calorie intake higher than expenditure.

All the food that we buy in tins and packets by law must tell us how many calories are in certain foods. The majority of foods now use the traffic light system. This gives us a colour (red, amber, green) to signify the amount of calories, fat, salt and sugar content. The exact number of calories, fat, salt and sugar should also be easily distinguished.

Monday, November 5, 2012

In-office blood testing

The Maine Childhood Lead Poisoning Prevention Program is pleased to announce rules adopted Nov. 5 now allow providers two options for blood lead testing:


1. Continue to submit blood lead samples to the State Health and Environmental Testing Laboratory; or

2. Perform capillary blood lead analysis using a CLIA waived in-office blood lead testing device, such as a LeadCareII, and directly report all test results to Maine Childhood Lead Poisoning Prevention Program.

Providers must have approval from the Maine Childhood Lead Poisoning Prevention Program before they can begin in-office testing.

The intent of the law is to increase blood lead testing of children under age 6 years by removing barriers to testing, such as travelling to an off-site location to have blood drawn. Using a direct-read blood lead analyzer, providers will be able to perform a capillary blood lead test and within minutes report the result to the patient’s parent/guardian. (Note: All elevated blood lead levels will require a venous confirmation through the State Health and Environmental Testing Laboratory.)

For more information, visit http://go.usa.gov/YhnT

Thursday, November 1, 2012

Data types, part 1: Ways to store variables


I've been alluding to different R data types, or classes, in various posts, so I want to go over them in more detail. This is part 1 of a 3 part series on data types. In this post, I'll describe and give a general overview of useful data types.  In parts 2 and 3, I'll show you in more detailed examples how you can use these data types to your advantage when you're programming.

When you program in R, you must always refer to various objects that you have created.  This is in contrast to say, Stata, where you open up a dataset and any variables you refer to are columns of that dataset (with the exception of local macro variables and so on). So for example, if I have a dataset like the one below:



I can just say in Stata

keep if Age>25

and Stata knows that I am talking about the column Age of this dataset.

But in R, I can't do that because I get this error:



As the error indicates, 'Age' is not an object that I have created.  This is because 'Age' is part of the dataframe that is called "mydata".  A dataframe, as we will see below, is an object (and in this case also a class) with certain properties. How do I know it's a dataframe? I can check with the class() statement:



What does it mean for "mydata" to be a dataframe? Well, there are many different ways to store variables in R (i.e. objects), which have corresponding classes. I enumerate the most common and useful subset of these objects below along with their description and class:

Object Description Class
Single Number or
letter/word
Just a single number or
character/word/phrase in quotes
Either numeric or character
Vector A vector of either all numbers or all
characters strung together
Either all numeric
or all character
Matrix Has columns and rows -
all entries are of the same class
Either all numeric
or all character
Dataframe Like a matrix but columns can
be different classes
data.frame
List A bunch of different objects all
grouped together under one name
list


There are other classes including factors, which are so useful that they will be a separate post in this blog, so for now I'll leave those aside. You can also make your own classes, but that's definitely beyond the scope of this introduction to objects and classes.

Ok, so here are some examples of different ways of assigning names to these objects and printing the contents on the screen.  I chose to name my variables descriptively of what they are (like numeric.var or matrix.var), but of course you can name them anything you want with any mix of periods and underscores, lowercase and uppercase letters, i.e. id_number, Height.cm, BIRTH.YEAR.MONTH, firstname_lastname_middlename, etc.  I would only guard against naming variables by calling them things like mean or median, since those are established functions in R and might lead to some weird things happening.

1. Single number or character/word/phrase in quotation marks: just assign one number or one thing in quotes to the variable name

numeric.var<-10
character.var<-"Hello!"









2. Vector: use the c() operator or a function like seq() or rep() to combine several numbers into one vector.

vector.numeric<-c(1,2,3,10)
vector.char<-rep("abc",3)



3. Matrix: use the matrix() function to specify the entries, then the number of rows, and the number of columns in the matrix. Matrices can only be indexed using matrix notation, like [1,2] for row 1, column 2. More about indexing in my previous post on subsetting.

matrix.numeric<-matrix(data=c(1:6),nrow=3,ncol=2)
matrix.character<-matrix(data=c("a","b","c","d"), nrow=2, ncol=2)



4. Dataframe: use the data.frame() function to combine variables together. Here you must use the cbind() function to "column bind" the variables. Notice how I can mix numeric columns with character columns, which is also not possible in matrices. If I want to refer to a specific column, I use the $ operator, like dataframe.var$ID for the second column.

dataframe.var<-data.frame(cbind(School=1, ID=1:5, Test=c("math","read","math","geo","hist")))



Alternatively, any dataset you pull into R using the read.csv(), read.dta(), or read.xport() functions (see my blog post about this here), will automatically be a dataframe.


What's important to note about dataframes is that the variables in your dataframe also have classes. So for example, the class of the whole dataframe is "data.frame", but the class of the ID column is a "factor." 






Again, I'll go into factors in another post and how to change back and forth between factors and numeric or character classes.

5. List: use the list() function and list all of the objects you want to include. The list combines all the objects together and has a specific indexing convention, the double square bracket like so: [[1]]. I will go into lists in another post.

list.var<-list(numeric.var, vector.char, matrix.numeric, dataframe.var)



To know what kinds of objects you have created and thus what is in your local memory, use the ls() function like so:


To remove an object, you do:

rm(character.var)

and to remove all objects, you can do:

rm(list=ls())

So that was a brief introduction to objects and classes.  Next week, I'll go into how these are useful for easier and more efficient programming.