Fixed R PDF generation