modify for R