Pages

Monday, October 22, 2012

Getting data in and out of R

One of the great advantages of R is that it recognizes almost any data format that you can throw at it. There are a myriad of different possible file formats but I'll concentrate on the four files that we see almost exclusively in public health: Excel files, Stata .dta files, SAS transport, and sas7bdat files. Luckily, there are a few packages that can help to import and export these files.

First off, I recommend always setting your working directory. This means that you set up to which folder all data is coming in and out of and that way you won't mess up with typing in the directories over and over again. You do it this way:

setwd("C:/Projects/Rforpublichealth")

Great, now that that is done, you can start importing and exporting:

(1) Excel files

This is the easiest one - R has built in functions called read.csv() and write.csv() that work great. They maintain first line variable headings. I find that if you have an .xls file, the best thing to do is to save it as a .csv before trying to input into R.  There are ways to get .xls into R but it's not worth the trouble since converting to a .csv takes 5 seconds.  The function looks like this:

mydata<-read.csv(file="mydata.csv")

There are options for not maintaing first line variable headings (Header=FALSE), but I can't really think of a time that you would want to do that.  You can also change what symbol is delimiting your data (tab delimited for example with sep = "\t") , but again I have never used those options.  If you're in need of those options, you can read about them here.






As you see on the left, R will automatically convert missing cells to NA, meaning that it's a numeric variable. If you have periods or something else that indicates missing in your CSV file, you could do a find and replace of the csv file for periods and change them to blanks.






Otherwise you can fix it with an ifelse() statement like:

mydata$SBP<-as.numeric(ifelse(mydata$SBP==".", NA, mydata$SBP))

Or with an apply() statement. Check out my earlier blog post about this.


Back to importing:  If you get an error like the one you see to the right, 99.9% of the time you have misspelled the name of the file or put it into the wrong folder. Always check to make sure the directory name and the file name match up and all your slashes are in the right place.


Now, let's say you change some things and want to export your data back into a csv. To export, you do:

write.csv(mydata, file="mynewcsvfile.csv")


(2) Stata .dta files

For this, you will need the foreign package.  You must first install the foreign package (you just use the menu bar in R, find the "Install packages" option and go from there).  Then you must then load the library this way:

library(foreign)

Now you can use the read.dta() and write.dta() functions. They are very similar to the read and write csv functions, and look like this:

mystatadata<-read.dta(file="mystatafile.dta")

write.dta(mystatadata, file="mystatafile2.dta")


(3) SAS files

(a) SAS transport files

SAS can be tricky because it uses both transport (XPORT) files as well as sas7bdat files and they are very different in terms of their encoding.  The XPORT files are most common and easier to work with.  For these, you need to first install and load the SASxport library

library(SASxport)

Now, you can use the read.xport() function in the same way we have used the other read functions:

mysasdata<-read.xport(file="mysasfile.xpt")

And again we can export:

write.xport(mydata, file="mynewsasfile.xpt")


(b) SAS7bdat files

This used to be a huge pain. Fortunately, there is a new package for reading these files into R called the sas7bat package. First, install this package and load. Then use the read.sas7bdat() function:

library(sas7bdat)

mysas7bdat<-read.sas7bdat(file="myothersasfile.sas7bdat")

However, I have personally had some problems with this function not working for me. Hopefully it will work for you. If it doesn't, you can try to convert the SAS file using StatTransfer or with JMP if you don't have SAS on your computer.


Sunday, October 21, 2012

3 Foods For Better Brain Function

http://kampoengtahes.blogspot.com/

Today I'm not going to talk about the short term fix (even thought I do have what I call the 'Mind Mastery Stack' which is what I use on days that I have long and important test/exams). Instead, let's look at three things that I do everyday to improve the function of my brain over the long term so hopefully as time goes on I can hold onto my 'marbles' and delay losing them :)


1. Eat blueberries - This probably comes to no surprise as the brain boosting benefits of blueberries essentially started the super food revolution. The antioxidants in these dark brain boosting nuggets have been shown time and time again to improve cognition and memory. Despite the well publicized and documented benefits of blueberries I still find that most people aren't eating them on a regular basis (are you?). I'm talking about eating them everyday. You don't need to eat organic or fresh ones either. Frozen blueberries are convenient, more cost effective, and just as nutritious. Start making a habit of eating 1 cup of blueberries everyday.

2. Fish Oil - If you read my blog on a daily basis you know that I LOVE fish oil. I don't love the fishy taste - that's not what I mean. I do love the drug like effects that they have. Research aside I have seen first hand with family and clients noticeable improvements in the memory of people taking 2-3g of EPA/DHA each day in as little as one month. That is truly amazing. There is also a fascinating body of research that is starting to build showing the beneficial effects of high dose fish oil in people with Alzheimer's disease. Plus if you are pregnant and take fish oil you can boost your child's I.Q. by a couple points as well (I know a couple points isn't going to make your son/daughter the next Steve Jobs but every little bit helps right?)

3. Low Impact Carbs - Wanna know America's #1 killer? Uncontrolled blood sugar levels. Seriously. Excess blood glucose is 'toxic' to your body. Controlling your blood sugar will also help you manage inflammation (inflammation is now being implicated as one of the major driving forces behind the aging process). Elevated blood sugar levels lead to increase glycation (basically this is when glucose molecules stick to things that they shouldn't, like proteins or amino acids). This can lead to the formation of advanced glycation end-products (AGEs). AGEs have been not only implicated in the aging process but cancer, neurodegeneration (bad for brain function) and heart disease. Bad news huh? How can we avoid this? Controlling your blood sugar is as simple as controlling your carbs. To do this, I recommend that you focus on eating low impact carbs - broccoli, chick peas, spinach, peppers, black beans. When you prevent the blood sugar roller coaster from happening in you body each day you will provide your body and brain with a constant flow of energy throughout the day. This will fight the formation of AGEs and slow the inevitable neurodegeneration.

We all want to be smarter, think more clearly, and remember more stuff right? The three simple nutrition strategies that I have outlined above will directly impact on how your brain functions. As I mentioned in the beginning these are not quick fix blast your body with stimulant strategies. Eating blueberries, taking fish oil, and eating low impact carbs will help you improve your brain function over time (and hopefully slow the aging process as well). This is easy stuff to do - make it happen.

Friday, October 19, 2012

Trusting Labels Alone Will Make You Fat

For millions of overweight Americans, the struggle to lose weight looms overhead.  Or should I say underneath your shirt. A tough task at hand when at every corner you turn, you can super size this, or get a super affordable value meal which is good for your wallet but bad for your gut. Furthermore, product labeling is more revolved around marketing angles than really informing the public. Well this article will delve into the misleading practices of big food conglomerates. I'm talking about the General Mills, Proctor and Gamble and Krafts of the world. These companies are interested in profits and they are winning at the expense of American health.

Low Fat or Non Fat Foods that are Just Too Good To Be True

Before I continue, did you know that some fats are actually good for the body. Did you know that without certain fats, we could not survive. Many big companies place the Non Fat and Low Fat labels on items giving consumers a false sense of security. Sure I can eat this whole box of cookies in front of the TV tonight because it says that they are low fat. If you sit in front of the tv and eat a whole box of cookies, I don't even care if it says NO Fat you will still be harming your efforts to lose weight. See, the consumer eats up, no pun intended, the slogan called low fat because they feel that they are doing a good deed to their body. But what the big food companies do not tell you is that in the place of fat is extra sugar or simple carbohydrates. Sugars and carbohydrates are the real saboteurs of a healthy diet.

Simple carbohydrates simply turn in to sugar and ultimately turn in to excess body fat. The best way to gauge a products nutritional stats is to turn the box over and check the label. You know, the Nutritional Facts label that is mandatory on every product that rests on a shelf in every supermarket. It's there because that is anunadulterated nutrition sheet telling you exactly what you are consuming. Check the percentages. Chances are that on products with that low fat, non fat hype the sugar and carbohydrate percentages are high for one serving. A simple rule to follow is if the food is sinful in nature, consume with caution. Chances are the low fat or non fat appeal is truly geared towards marketing.

You can protect yourself by being educated. The one thing to keep in mind is that large food companies are in business to sell food. Not all of their food is 100% nutritious. If you don't eat the food, they do not make a profit. So the food companies will say whatever they can legally get away with to attract buyers. Keep that in mind and follow up with label inspection and you will be able to dodge the bullets of misinformation.

Monday, October 15, 2012

What a nice looking scatterplot!


This week, we look at plotting data using scatterplots. I'll definitely have a post on other ways of plotting data, like boxplots or histograms.

Our data from last week remains the same:


First, a quick way to look at all of your continuous variables at once is just to do a plot command of your data.  Here, I will subset the data to just take three columns and plot those against each other:

plot(mydata[,c(2,4,5)])

This takes all rows, and the columns 2, 4, and 5 from the dataset and plots them all against each other, like this:



Next, I want to make a nice scatterplot of Weight on Height.  The basic format is

plot(xvariable, yvariable)

So it looks like this:

plot(mydata$Weight, mydata$Height)


But this is a little ugly.  Fortunately, there are a million options that I can take advantage of.  In this first post on plotting, I will:

  • add labels for the x and y axes (xlab and ylab, respectively) 
  • change the dimensions of the plot so it's not quite so condensed (xlim and ylim)
  • add a title (main) and change the font size of the title (cex.main)
  • get rid of the frame around the plot (frame.plot=FALSE)
  • change the type of plotting symbol from little circles to little trianges (pch=2) and make those little triangles blue (col="blue").


plot(mydata$Weight, mydata$Height, xlab="Weight (lbs)", ylab="Height (inches)", xlim=c(80,200), ylim=c(55,75), main="Height vs Weight", pch=2, cex.main=1.5, frame.plot=FALSE , col="blue")



Now, let's get a little more complicated.  I want the color of the plot symbol to be indicative of whether the observation is male or female, and to put a legend in there too. This is super easy right inside the plot function call using the ifelse() statement.  To review, the ifelse() statement is similar to the cond() statement in Stata.  It looks like this:

ifelse(condition, result if condition is true, result if condition is false)

So here I change my parameter col=blue to col=ifelse(mydata$Sex==1, "red", "blue"). This is saying that if the sex is a 1, make the color of the triangle red, else make it blue:

plot(mydata$Weight, mydata$Height, xlab="Weight (lbs)", ylab="Height (inches)", xlim=c(80,200), ylim=c(55,75), main="Height vs Weight", pch=2, cex.main=1.5, frame.plot=FALSE, col=ifelse(mydata$Sex==1, "red", "blue"))

Then I add in the legend. The first two parameters of the legend function are the x and y points where the legend should begin (here at the point (80,75)).  Then I indicate that I want two triangle symbols (pch=c(2,2)).  The first 2 is for the number of symbols and the second 2 is to indicate that pch=2 (a triangle) as it was in the previous example.  Next I say I want the first triangle to be red and the second one blue.  I label the two symbols with the labels "Male" and "Female".  Next, I indicate I want a box around the legend (bty="o") and that I want the box to be darkgreen.  Finally, I indicate that the font size of the whole legend text should be .8. (cex=.8).

legend(80, 75, pch=c(2,2), col=c("red", "blue"), c("Male", "Female"), bty="o",  box.col="darkgreen", cex=.8)



Incidentally, I could get the same plot by identifying "topleft" in my legend() call, as below.  But sometimes it's nice to put the legend exactly where you want it and the legend options only allow for “bottomright”, “bottom”, “bottomleft”, “left”, “topleft”, “top”, “topright”, “right”, “center”.

legend("topleft", pch=c(2,2), col=c("red", "blue"), c("Male", "Female"), bty="o", cex=.8, box.col="darkgreen")

Finally, one of the really nice aspects of R is being able to manipulate the plot region and make it do exactly what you want.  For starters, we can have two plots side by side, by indicating:

par(mfrow=c(1,2))

meaning one row and two columns. If I wanted a 2 by 2 plot area, I would do mfrow=c(2,2).

Now I'll show the full code for the plot below.  The first part is just the first plot we already did, but I add in a vertical line at the average weight and add in text.  The second plot is Height on Age, and I add in the linear regression line.  To do this is quite easy.  I start by running the regression of Height on Age and save it as "reg".  Then I use abline() to add the line to the plot.  Finally, I use the text() function to add text to the plot anywhere I want.  I walk you through the code below:


##set up the plot area with 1 row and 2 columns of plots
par(mfrow=c(1,2))

##first plot height on weight
plot(mydata$Weight, mydata$Height, xlab="Weight (lbs)", ylab="Height (inches)", xlim=c(80,200), ylim=c(55,75), main="Height vs Weight", pch=2, cex.main=1.5, frame.plot=FALSE, col="blue")

##add in the vertical line at the mean of the weight, using na.rm=TRUE to remove the NAs from consideration
abline(v=mean(mydata$Weight, na.rm=TRUE), col="orange")

##add in text at the point (140, 73), with font size .8. The position is 4, meaning that the text moves to the right from the starting point. The "\n" is a carriage return (moves the text to the next line)
text(140,73, cex=.8, pos=4, "Orange line is\n sample average\n weight")

##add in the second plot of height on age
plot(mydata$Age, mydata$Height, xlab="Age (years)", ylab="Height (inches)", xlim=c(0,80), ylim=c(55,75), main="Height vs Age", pch=3, cex.main=1.5, frame.plot=FALSE, col="darkred")


##run a linear regression of Height on Age - if this is confusing, I'll do a post on linear regressions very soon
reg<-lm(Height~Age, data=mydata)

##add the regression line to the plot
abline(reg)


##add text to the plot. Start at the point 0,70.  Position the text to the right of this point (pos=4), make the font smaller (cex=.8), and add in the text using the paste function since I'm pasting in both text and the contents of some variables. For the text, I extract the intercept by taking the first coefficient from the reg object with the code reg$coef[1]; and the coefficient on Age by taking the second coefficient, reg$coef[2].  I round both of those to the second decimal point using round(x,2). There's a lot going on here but hopefully I've unpacked it for everyone.
text(0,72, paste("Height ~ ", round(reg$coef[1],2), "+", round(reg$coef[2],2), "*Age"), pos=4, cex=.8)


Plots are really fun to do in R.  This post was just a basic introduction and more will come on the many other interesting plotting features one can take advantage of in R.  If you want to see more options in R plotting, you can always look at R documentation, or other R blogs and help pages.  Here are a few:







Tuesday, October 9, 2012

Healthy Lifestyle Diet Tips

http://kampoengtahes.blogspot.com/Many people, especially women, want to lose weight whether it is to wear old clothes or to look good out in public. Whatever it is, all women want to feel good about themselves and the way they look, especially to men. People are always trying to lose weight and with all the diets and countless new ads, it becomes overwhelming to someone just starting out and they end up with no progress. The best way to begin losing weight is to start with simple lifestyle changes that will build motivation and will even help lose weight in the beginning stages. It is important to build a solid foundation before going on to more strict regimens and diets.

The best thing to change is to cut out all types of junk food and processed foods. This includes chips, cookies, ice cream, etc. Anything that isn't grown in the earth should not be part of the meals in the diet. The best foods are whole grown, naturally raised foods. These include but are not limited to; eggs, milk, chicken, beef, and vegetables. Having a balanced diet of the foods listed will give you energy throughout the day and make the foods more enjoyable to eat compared to bland meals.

Another simple step, but relatively difficult, step to do is to drink only water in substitute of any other liquid or drink. Cutting out cocktail drinks, liquor, beer, sugar, juices, and other sugary drinks and replace it with water will help you lose many pounds a week in itself. Water is refreshing and nourishing to the body and is proven to help with other things as well such as clearing skin and helping kidney functions. This simple step is difficult, but yields some of the best rewards.

While doing workouts and other physical activity is not needed to lose weight (as long as healthy eating is persistent), it can help make the process faster. This does not mean you need to workout 7 days a week hours in at the gym, but simple things to burn extra calories is very beneficial. For example, taking stairs instead of the elevator in itself will add up to many burned calories throughout the week and month.

There are many ways to lose weight, but it is best to not think of it as a "diet" but instead focus on a total health lifestyle transformation. This will build a strong foundation and aid in losing more weight down the line by introducing proper habits and lifestyle choices.

Healthy Maine Walks

Scientific research has shown that regular physical activity not only promotes health and well-being, it also reduces the risk of developing many chronic diseases and of becoming overweight or obese. Walking routes offer a safe and fun way to get health-promoting physical activity. Walking requires little or no equipment and can be enjoyed by most individuals, regardless of their abilities. Many routes are also wheelchair accessible.


Healthy Maine Walks is the most comprehensive listing of walking routes in the state. A Healthy Maine Walk is an accessible indoor or outdoor walking route that most people can walk in one hour or less at a brisk pace. Walking routes may be a local high school track, a downtown "museum in the streets" trail, or a portion of a larger trail system. This website is designed specifically to provide users with information about where to find a place to walk near where they live, work or play to help them lead an active healthy lifestyle.

This online resource has just undergone its first major overhaul since being launched more than ten years ago. The new site is more user friendly and provides more information about the walking routes listed. Most of all it enables people across the State who manage and maintain walking routes to upload their route information directly by becoming a HMW “Walk Liaison”. To learn how you can become a Walk Liaison, or to find a walk near you, go to www.healthymainewalks.com, or contact Doug Beck (doug.beck@maine.gov) Physical Activity Coordinator in the Maine CDC Division of Population Health for more information.

Monday, October 8, 2012

Summarizing Data

In this post, I'll go over four functions that you can use to nicely summarize your data.  Before any regression analysis, a descriptive analysis is key to understanding your variables and the relationships between them.  Next week, I'll have a post on plotting, so this post is limited to the summary(), table(), and aggregate() functions.

Here is my dataset for this example:




The first thing I want to do is look at my data overall - get the range of values for each variable, and see what missing values I have.  I can do this simply by doing:

summary(mydata)

This produces the output below, and shows me that both Weight and Height have missing values. The Migrantstatus variable is a factor (categorical), so it lists the number in each category.







If I want to just summarize one variable, I can do summary(mydata$Weight) for example. And remember from last week, that if I just want to summarize some portion of my data, I can subset using indexing like so:  summary(mydata[,c(2:5)])

Next, I want to tabulate my data.  I can do univariate and bivariate tables (I can even do more dimensions than that!) by using the table() function.  Table() gives me the totals in each group.  If I want proportions instead of totals, I can use prop.table() around my table() function.  The code looks like this with the output below:

table1<-table(mydata$Sex)

table1
prop.table(table1)



Next, I do the bivariate tables.  The first variable is the row and the second is the column.  I can do proportions here as well, but I must be careful about the margin.  Margin=1 means that R calculates the proportions across rows, while margin=2 is down columns. I show a table of Sex vs Marital status below with two types of proportion tables.

table2<-table(mydata$Sex, mydata$Married)

table2
prop.table(table2, margin=1)
prop.table(table2, margin=2)



And if I want to do three dimensions, I put all three variables in my table() function.  R will give me the 2x2 table of sex and marital status, stratified by the third variable, migrant status.


table3<-table(mydata$Sex, mydata$Married, mydata$Migrantstatus)

















The great part about R is that I can take any component of this table that I want.  For example, if I just want the table for migrants, I can do:

table3[,,1]

which tells R to give me all rows and columns, but only for the first category of the third variable.  I get the following output, which you can see is the same as the first part of table 3 from above.








Finally, what if I want to calculate the mean of one variable by another variable? One way to do this is to use the aggregate() function.  Aggregate does exactly that: it takes one variable (the first argument) and calculates some kind of function on it (the FUN= argument), by another variable (the by=list() argument).  So here I am going to do the mean weight for each sex.  Here the syntax is a little funny because R wants a list for the by variable.  I will go over lists at another post in the future, or you can look it up on another R site.

aggtable<-aggregate(mydata$Weight, by=list(mydata$Sex), FUN=mean)
aggtable




However, something is wrong. The NA in the weight column is messing up my mean calculation.  To get around this, I use the na.rm=TRUE parameter which removes any NAs from consideration.

aggtable.narm<-aggregate(mydata$Weight, by=list(mydata$Sex), FUN=mean, na.rm=TRUE)
aggtable.narm





Victory! If I want to name my columns of this table, I can do:

names(aggtable.narm)<-c("Sex","Meanweight")

And of course if you want to do mean tables by more than one variable, you can put the all in the list argument, like so: by=list(mydata$Sex, mydata$Married).  The code and output would look like this:


aggtable.3<-aggregate(mydata$Weight, by=list(mydata$Sex, mydata$Married), FUN=mean, na.rm=TRUE)

names(aggtable.3)<-c("Sex","Married","Meanweight")

aggtable.3












Breast Cancer Awareness

Maine CDC recognizes October as Breast Cancer Awareness Month. In 2012, it is anticipated that 1,170 Maine women will be diagnosed with breast cancer and 180 women will die from the disease.


Eating more fruits and vegetables and exercising regularly are two important steps to lessen the risk. To increase the chance of finding breast cancer early, it is important that women be screened regularly. Early detection is the best protection and mammograms are still the best screening test. The 2010 Behavioral Risk Factor Surveillance Survey found that more than 80% of 221,241 Maine women age 40 and older reported having a mammogram in the past two years.

Help is available for women age 40 and older who are in need of breast, cervical, and colorectal screening tests if they meet program qualifications. The Maine CDC Breast and Cervical Health and Colorectal Cancer Control Programs can provide information about cancer screening tests as well as resources for free cancer screenings.

Interested women are encouraged to call 1-800-350-5180 or 1-207-287-8068, TTY users call Maine Relay 711. More details can also be found at: http://go.usa.gov/Y4b3

Friday, October 5, 2012

Recognizing Disease Intervention Specialists

Maine CDC, in conjunction with the National Coalition of Sexually Transmitted Disease Directors (NCSD), will be participating in the first National Disease Intervention Specialists Recognition Day on Friday. Intended to be an annual event celebrated the first Friday of October, the day has been set aside to honor the Disease Intervention Specialists (DIS) workforce, which is the underpinning of all STD and HIV programs.


DIS personnel provide confidential interviews to people diagnosed with an STD to address concerns about their diagnosis, treatment, counseling, and referral needs. In addition, they work to obtain the names and contact information of sexual and needle-sharing partner(s) in order to confidentially notify them of their possible exposure and offer counseling, testing, and treatment. This service effectively breaks the chain of disease transmission and protects public health.

In 2011, DIS in Maine worked 1,768 cases of individuals diagnosed with an STD or HIV. All of those diagnosed with HIV and 85% of those with an STD were successfully linked to treatment and services.

For additional materials and information on HIV and STDs in Maine, visit: www.mainepublichealth.gov/std

Thursday, October 4, 2012

National Food Day, Oct. 24

The focus of National Food Day is very close to home here in Maine. Setting aside one day to focus on food reminds us of:

  • the connection between health and great tasting food, like Maine apples;
  • what we can do to end hunger; and
  • the importance of having Maine farms and farmers that produce some of the best tasting fruit, vegetables, meats, chicken, fish, and grains in the nation.
Every day truly could be food day here in Maine. Take some time this month to stop and think about what you eat.  
  • Are the food choices you are making keeping you well?
  • Did you ever wonder where your apples or carrots or meat comes from?
  • Do you take time to enjoy the flavor of your food?
If you answered “No” to any of these questions, take action by taking the Food Day Challenge:
1. Take a small step to eat like your life depends on it - it does.
  • Add one more veggie to your meals.
  • Switch to lower fat dairy, whole grains, and grilled, baked, or broiled foods.
  • Eat a little less.
2. Look for local produce in season. Farmers markets go all year long now.
 
3. Savor your food with a family member or a friend.
4. When you donate foods to the food bank, think about health.

For healthy recipes, check http://recipefinder.nal.usda.gov/, which allows you to search for healthy and affordable recipes. Each recipe includes nutritional information, ingredients, instructions, and cost per recipe and per serving.

Wednesday, October 3, 2012

Thermogenic Fat Burning Foods

http://kampoengtahes.blogspot.com/It sounds like a diet publicity trick, but, unbelievably, some foods actually have a fat burning thermogenic effect within the body as well as an increase in metabolism. Millions of people across the world search daily to find new ways to burn fat and lose weight. Fat burning foods may be a very effective method for some and are generally characterized as a food which uses a large portion of the calories it contains to process and digest it. These foods are also considered to be foods that boost the metabolism and reduce fat.

Recent research has proven there is a compound in green tea that offers a slight increase in metabolic rate. However, it would take three to four strong cups of green teas in order to get the necessary amount. It may be obtained by green tea supplements as well. In addition, green tea has no calories. Another food that may be effective at burning fat is hot peppers that contain capsaicin, which produces a thermogenic effect. This thermogenic effect is not going to make you lose a lot of weight instantly. However, it will boost your metabolism for a few hours. A few foods that are considered good fat burning foods include:

- Citrus fruits
- Oats
- Vegetables
- Lentils
- Poultry
- Eggs
- Almonds
- Walnuts
- Salmon

http://kampoengtahes.blogspot.com/In addition, water is a very important aspect of losing weight as it helps flush out toxics and can help in the process of fat reduction. Water helps improve the metabolism of the body and helps reduce the workload on the heart and other organs allowing the body to effectively burn fat.

While all foods are thermogenic to an extend some foods are more thermogenic than others. The most thermogenic foods are the ones with lean protein such as:
- Chicken breast
- Wild game meats (Venison, el, etc.)
- Fish
- Egg whites
- Lean red meats

Digestion of protein requires about thirty percent of the calories it contains just for digestion making it one of the highest thermogenic fat burning foods. In addition, lean proteins are known to suppress your appetite. This is one of the many reasons that numerous diets call for an increase of lean protein consumption. When you are aiming to lose weight it is important to try a combination of thermogenic lean proteins, essential fats, and plenty of fresh fruits and vegetables. You will notice that your body will naturally start dropping the additional weight and you will begin to feel healthier and more rejuvenated.

In addition to a proper diet, a regular exercise routine is suggested as well. Exercise helps promote heart health, tones and strengthens muscles, enhances flexibility and controls weight. If you are not used to exercising it is suggested that you start off slow and work your way up to a more intense workout. Remember to perform proper stretching techniques before and after your workout as well.

A combination of thermogenic foods that burn fat with other nutritious foods and a regular exercise program will be sure to help you with your weight loss efforts.

Monday, October 1, 2012

Juicing Benefits From Fresh Fruits and Vegetables

Sure there are several bottled juices you can readily buy from groceries and other retail stores. They can be more convenient. However, when it comes to juicing benefits, they can never come close to what you can gain from juicing fresh fruits and vegetables.

Cure for Cancer

http://kampoengtahes.blogspot.com/The National Cancer Institute have recently started their campaign on encouraging people to eat more of fruits and vegetables as an important component in the cure and prevention of cancer. It is also revealed from several studies that fruits are better when taken fresh and vegetables when eaten raw.

You can easily achieve this with juicing benefits. Extracting the juice from fruits and vegetables empowers the body to quickly absorb the vitamins and minerals found from fresh fruits and raw vegetables. It also speeds up digestion, as there are some fibers in both fruits and vegetables that can be a little difficult to digest when eaten whole.

Boost Immunity to Diseases

Including fresh fruit and vegetable juices to your everyday diet can strengthen your immunity against diseases. This is one of the main benefits too hard to ignore. You see, when the body's natural defense is strong, you can easily fight off and prevent diseases to attack your system. You will be able to minimize or eliminate the risks of contracting diseases when your immune system is strong.

Juicing Encourages You to Eat Fruits and Vegetables

While there is a high level of awareness among the public on the importance of eating more of fruits and vegetables, unfortunately most are not actually doing it. Juicing is one way to attract and encourage people to benefit from fruits and vegetables. One of the juicing benefits is that there are several delectable recipes for juices that will make drinking juice more exciting.

Get More Enzymes with Fresh Juices

Fresh juices- fruits or vegetables or a mixture of both deliver more enzymes than any other forms of juices. This is because fresh fruit or vegetable juices are free from chemicals, preservatives, and do not undergo heat that kills the enzymes. If you are not aware of the importance of enzymes, these are what the body needs to prolong life.

S­lows the Aging Process

If you want to delay your aging, you just have to drink fresh juices. Fruit and vegetables juices are found to be rich sources of anti-oxidants that fight off the damage cause by the free radicals in the body including the skin. Some of the benefits include strengthening the muscles and preventing the signs and symptoms of aging from showing, such as wrinkles and skin dryness. It also prevents ailments that are commonly associated with aging.

Natural Way to Lose Weight

Who can argue with weight loss as a juicing benefit? Drinking fresh fruit and vegetable juices as part of a weight loss program is proven to be effective, safe, and economical. With fresh juices, you are activating the body's metabolism to burn more calories and therefore make you lose excess and unnecessary weight. It is nature's way to help you keep your ideal weight for your good health above anything else.

Get your juicing information right now by going to Lifestyles100 to read articles or pick up the new Nook version of "Juicing Recipes and Tips" at Barnes and Noble
Start living healthier by including fruit and vegetable juices to your nutritional and healthy diet.

Quick and Easy Subsetting



Public health datasets can be enormous and difficult to look at.  Often it is great to be able to only look at specific parts of the dataset, or to only run analysis on a specific part of a dataset.  There are two ways that you can subset a dataset in R:

  1. Using the subset() function
  2. Using matrix indexing
The first way may sound easier, but the second one is very useful.  Let me show you why.

Let's start with the subset() function.  The basic structure is like this:

subset(x, condition, select=c(var1, var2))

where x is the original dataset you want to subset, condition is a condition on your rows, and select is the columns you want to keep.  So for example, I have a dataset called mydata, shown below.  I want to look at only women that are over 50 years old, and I only want to look at their ID, age, and weight.  Therefore I do this:

sub.data<-subset(mydata, Age>50 & Sex==0, select=c(ID, Age, Weight))

So here I am saying, take the dataset called "mydata", take only rows where the Age >50 and the Sex ==0 (when you write a condition, you always use two equal signs), and then take only the columns ID, Age, and Weight.

Here are the original (left) and the subsetted (right) datasets:

         










You can also do a statement like this:

sub.data2<-subset(mydata, Age>50 & Sex==0, select=c(ID:Sex))

which takes all of the columns between (and including) ID and Sex.  This is nice so you don't have to list out all the variables one by one.

However, now let's take a more real example.  I have a dataset with 200 columns and 3000 rows. I want to keep say 50 columns, but they're not all sequential.  Some are at the beginning of my dataset, some are at the end.  Do I have to go in and write out each name of the variable? Nope.  Instead we can use R's matrix indexing capability.  It's super easy and it goes like this in a general form:

newdata<-originaldata[rows I want, columns I want]

The comma is crucial here since the dataset is organized by rows and columns.  If you don't put anything in the "rows I want" place, R keeps everything. So, for example, I can do this:

sub.data3<-mydata[,c(1:3)]

So this is saying, take the dataset "mydata", and take all the rows (since there is nothing before the comma), and take columns 1-3.  Call this subsetted dataset "sub.data3".  

I can also make the equivalent statement from sub.data2 using indexing like this:

sub.data4<-mydata[mydata$Age>50 & mydata$Sex==0, c(1:3)]

Or, if I just want to look at the first 50 observations and all columns, I can do this:

sub.data5<-mydata[c(1:50), ]

Finally, I can do what I said before, in that I can choose the variables I want from a super long list. I first can find out the index numbers of my columns using the names() command like this:

names(mydata)

Then I can say I want columns 1-5, 8, 12-15, 100-120, 197, and 199.  I can easily do this by saying

sub.data6<-mydata[,c(1:5, 8, 12:15, 100:120, 197, 199)]

Finally, the last thing I want to point out is that if you want to keep most columns but just take away, say, the last 10, you can do this:

sub.data6<-mydata[,-c(190:200)]

The negative sign is like a 'drop' command.  Keep everything except the columns I list out.

It's a very nice feature and very fast!