Are you spending time with the right people for your health and happiness?

While many of us focus primarily on diet and exercise to achieve better health, science suggests that our well-being also is influenced by the company we keep. Researchers have found that certain health behaviors appear to be contagious and that our social networks — in person and online — can influence obesity, anxiety and overall happiness. A recent report found that a person’s exercise routine was strongly influenced by his or her social network.

I was reminded recently of the power of the crowd during a wellness cruise sponsored by Times Journeys. The event attracted a group of like-minded travelers who, despite experiencing various levels of adversity in their lives, including cancer, vision loss and the recent loss of a loved one, were remarkably optimistic and upbeat. The group ranged in age from 17 to 90. One inspiring man, in his 80s, had adopted a vegan lifestyle and a strict exercise routine to control his diabetes. Another new friend, a woman in her 50s who had survived lung cancer, cheered me on and kept me going during a particularly difficult workout.

After the trip, we all promised to keep in touch. Buoyed by the experience, I returned home with a renewed commitment not only to exercise and healthful living, but to simply step up my social life and spend more time hanging out with happy people.

Dan Buettner, a National Geographic fellow and author, has studied the health habits of people who live in so-called blue zones — regions of the world where people live far longer than the average. He noted that positive friendships are a common theme in the blue zones.