When working with human data, the eQTL data from the GTEx portal is a fantastic resource. For your list of variant IDs, you can actually retrieve the eQTL beta correlations and their p-values from the GTEx project using the Ensembl REST API with the following endpoint:
Answer from @maximilian-press, converted from comment:
Sometimes casting to as.numeric() will convert from two-dimensional matrix to one-dimensional vector. Based on the output you put into comments (which would be helpful in the question), I wonder if this has occurred and caused an issue. For data.matrix, I suggest reading docs for that function- it should ...