Background Enteropathogen detection traditionally relies on diarrhoeal stool samples, but these are inconvenient to collect if they are not immediately available, leading to suboptimum return rates of samples and delayed or missed diagnostic opportunities. We sought to compare the enteropathogen yields of rectal swabs and stool specimens in children with diarrhoea or vomiting, or both. Methods The Alberta Provincial Pediatric EnTeric Infection TEam (APPETITE) did a study in three outpatient cohorts in Calgary and Edmonton (AB, Canada)—children enrolled in the Pediatric Emergency Research Canada emergency departments, children receiving routine vaccinations at a Calgary health clinic, and symptomatic children who met criteria for treatment at home. Eligible participants were children younger than 18 years, with at least three episodes of vomiting or diarrhoea in the preceding 24 h and fewer than 7 days of symptoms. After excluding those enrolled within the previous fortnight, unable to follow-up, or having psychiatric illness, neutropenia, or requiring emergent care, we attempted to collect rectal swabs and stool from all participants. Specimens were tested with the multianalyte assay Luminex xTAG Gastrointestinal Pathogen Panel, an in-house five-virus panel and bacterial culture. Primary outcomes were comparative yield (calculated as the proportion of submitted paired specimens only in which at least one pathogen was identified) and overall yield (which calculated the proportion of study participants in whom at least one pathogen was identified in all specimens, where unsubmitted specimens were analysed as negative). We used McNemar's test to do pathogen-specific analyses, and generalised estimating equations (GEE) for the global (ie, any) pathogen analyses, with adjustments made for the presence of diarrhoea, location, and their interactions with specimen type. Findings Between Dec 12, 2014, and Aug 31, 2016, we studied 1519 eligible participants, 1147 (76%) of whom provided stool specimens and 1514 (>99%) provided swab specimens. 871 (76%) of 1147 stool specimens and 1024 (68%) of 1514 swabs were positive for any pathogen (p<0·0001). Comparative yield adjusted odds ratios (ORs) for stool specimens relative to swabs were 1·24 (95% CI 1·11–1·38) in children with diarrhoea at presentation and 1·76 (1·47–2·11) in children without diarrhoea. GEE analysis identified an interaction between the presence of diarrhoea and specimen type (p=0·0011) and collection location (p=0·0078). In an overall yield analysis, pathogen yield was 57% (871 of 1519 children) for stool specimens and 67% (1024 of 1519 children) for rectal swabs, with an unadjusted OR of 0·65 (95% CI 0·59–0·72) for stool relative to swab. Interpretation Rectal swabs should be done when enteropathogen identification and rapid detection are needed, appropriate molecular diagnostic technology is available, and a stool specimen is not immediately available. In view of their high yield, we urge that the recommendation against the use of rectal swabs as diagnostic specimens be reconsidered. Funding Alberta Innovates—Health Solutions Team Collaborative Research Innovation Opportunity.