.Call
is used to pass variables to C routines. C_cov
is a variable (in the stats
namespace we'll soon see) that tells .Call
where to find the routine that it should use to calculate covariance.
If you type C_cov
at the command line, you'll get
Error: object 'C_cov' not found
That's because it's hidden from you. You'll have to do a little detective work.
getAnywhere('C_cov')
# 4 differing objects matching ‘C_cov’ were found
# in the following places
# namespace:stats
# Use [] to view one of them
This tells us that there's a variable named C_cov
in the stats
name space (your output may look slightly different from this). Let's try to get it.
stats::C_cov
# Error: 'C_cov' is not an exported object from 'namespace:stats'
Apparently C_cov
is not for public consumption. That's all right, we can get it anyway:
stats:::C_cov # use three colons to get unexported variables.
# $name
# [1] "cov"
# # blah, blah, blah ...
# $dll
# DLL name: stats
# Filename: C:/Program Files/R/R-3.0.1/library/stats/libs/x64/stats.dll
# Dynamic lookup: FALSE
# # blah, blah, ...
That's the info we want. It tells us the name of the routine and library it's in. Now we just need to go to C source and follow the trail: .../src/library/stats/src/cov.c