Oupppsss... Too fast! It worked piece by piece, but once in a script:
Script:
cat("Enter Sample Size (n):")
n = as.integer(x = readLines(con = stdin(),ok=TRUE, n = 1))
cat("Enter the number of sample to draw (k):")
N_Sample = as.integer(x = readLines(con = stdin(),ok=TRUE, n = 1))
print(sample.int(n,N_Sample))
Output:
cat("Enter Sample Size (n):")
Enter Sample Size (n):> n = as.integer(x = readLines(con = stdin(),ok=TRUE, n = 1))
cat("Enter the number of sample to draw (k):")
Enter the number of sample to draw (k):> N_Sample = as.integer(x = readLines(con = stdin(),ok=TRUE, n = 1))
Looks like the data input command (readLines) gets the next line as data!
print(sample.int(n,N_Sample))
Error in if (useHash) .Internal(sample2(n, size)) else .Internal(sample(n, :
missing value where TRUE/FALSE needed