About one in five pilots says sleepiness has caused a serious error on the job, according to a new survey by the National Sleep Foundation. And about one in four pilots and train operators say that being sleepy affects job performance at least once a week.

The 2012 Sleep in America poll, which was released on Saturday, surveyed the sleep habits of 202 pilots, 203 truck drivers, 180 rail workers and 210 bus, taxi and limousine drivers. The data were compared with the habits of 292 adults over age 25 who don't work in transportation.

People who are sleepy have slower reaction times, decreased attention and problems learning and processing information. The Federal Aviation Administration in December issued an overhaul of its safety rules on pilot fatigue. The rules set more stringent limits on the length of pilots' workdays and expand the amount of time they have between shifts.

The study found transportation workers tend to get a similar amount of sleep in a 24-hour period as other adults—generally a little less than seven hours. The difference is that their schedules are much more variable. For instance, only 6% of pilots worked the same schedule every day.

"The more regular our wake times and sleep times are, the easier it is to sleep during the night and stay awake during the day," said Thomas J. Balkin, chief of the department of behavioral health at the Walter Reed Army Institute of Research and the chairman of the 2012 Sleep in America poll task force. By varying the schedule, "we can be getting less quality sleep, lighter sleep and feel sleepier during the daytime."

Transportation workers tend to have long shifts. Pilots averaged 10.4 hours and truck drivers averaged 10.1 hours, compared with 8.5 hours for the non-transportation workers.

Transportation workers also nap more than other workers, with 58% of pilots saying they sometimes nap during workdays, compared with 27% of non-transportation employees.

Dr. Balkin said one goal of the study is to "encourage the transportation industry to institute changes by improving schedules, including napping strategies and the judicious use of caffeine."

Write to Andrea Petersen at andrea.petersen@wsj.com