## create a function to be run as a separate process
    fn <- function() {
        Sys.sleep(4)
        print("World!")
    }
    ## fork the process
    pid <- fork(fn)
    ## do work in the parent process
    print("Hello")
    ## wait for the child process
    waitpid(pid)
Run the code above in your browser using DataLab