This code is non-sensical so getting the result isn't the important part, understanding why the two methods arrive at different conclusions is what I'm trying to understand.
days <- c(528, 900, 1050, 1300)
returns <- c(-46.9363726590971, 113.096047917561, -55.1435291957069, 251.540399180745)
# the operation I would like to do; note the NaN for two of them
returns ^ (252 / days)
# pulling out the first values fails in the same way
(returns) ^ (252 / days)
# and sapply yields the same result
sapply(X = seq_along(days), FUN = function(i) returns[i] ^ (252 / days[i]))
# just using the numbers gives a different result for the negative numbers
-46.9363726590971 ^ (252 / 528)
113.096047917561 ^ (252/900)
-55.1435291957069 ^ (252/1050)
251.540399180745 ^ (252/1300)
Why is this the case?