Function to generate k-skip-ngram in R.