Using cor() would be appropriate if you expected there to be a relationship between var1 and var2, for instance if you'd expect the value of an item in var2 to be larger if the corresponding item in var1 is larger. There is a difficulty when the data sets are not the same length, because there are no corresponding items to compare once you get past the end of the shorter dataset.
I think, in this case, that a comparison of the two data sets to establish if their means are different is more likely to be useful to you. For that, you'd want to use a t test, as described, with examples in R, here. You'd also want to confirm that the assumptions for using the t test are valid for this case, e.g. see here.