And since we can't copyright the output of a program, I wonder if this would essentially nullify the CC-BY protection of our data, since people could just download our R scripts, generate the data for themselves, and call it their own.
I am not sure of the claim "we can't copyright the output of a program"
Have you asked your lawyer about that claim?
I am not a lawyer
But I do know a lot of programs whose output can and is copyrighted.
A compiler produces an executable, and in some legal systems, that file is or can be protected by copyright laws. For example, both GCC and Clang or the Linux kernel are open source (millions of lines of code), and they are mostly written by developers paid for that work.
A transpiler such as Chicken Scheme produces C files, and you need these C files to build it since Chicken Scheme is a bootstrapped compiler from Scheme to C. In the
chicken-5.2.0 tarball, the
chicken-5.2.0/chicken.process.signal.import.c file is obviously generated, since its start with:
/* Generated from chicken.process.signal.import.scm by the CHICKEN compiler
Version 5.2.0 (rev 317468e4)
linux-unix-gnu-x86-64 [ 64bit dload ptables ]
command line: chicken.process.signal.import.scm -optimize-level 2 -include-path . -include-path ./ -inline -ignore-repository -feature chicken-bootstrap -no-warnings -specialize -consult-types-file ./types.db -feature chicken-compile-shared -dynamic -no-trace -output-file chicken.process.signal.import.c
uses: library eval expand
My Bismon project produces C code and requires the previously produced C code to be built. The generated C files contain a copyright notice. My past GCC MELT project did generate C++ code (from some Lisp dialect) and kept copyright notices in them.
The RefPerSys project is generating C++ files with a copyright notice.
The GNU bison parser generator is generating C files with a copyright notice. The GNU emacs editor is writing files and can be (and usually is) used to edit its own code.
The ocaml compiler is distributed with binary bytecode files generated by ocaml. You won't be able to build Ocaml from sources without these generated files.
Most Linux relational databases (sqlite, PostgreSQL) can dump their content as
*.sql textual files. With an easy sed(1) script you can prepend a copyright notice to these files.
Text formatters like LaTeX or Lout (both are open source programs) are routinely used to produce PDF files with a copyright on them, and the copyright on the produced output is unrelated to the copyright on these LaTeX or Lout software.
The CAIA system by the late J.Pitrat generates all its C code (about 500KLOC in 3834 C source files and 5976 small binary data files, generated in an hour of computer time), and is copyrighted and GPLv3+ licensed. Typical generated C code (I just reformatted it) looks like:
/* Copyright (C) 2000-2012 Jacques Pitrat
This generated file SPC0.c is part of CAIA.
CAIA is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your
option) any later version. CAIA is distributed in the hope that it
will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the GNU General Public License for more details. You should have
received a copy of the GNU General Public License along with CAIA. If
not, see <http://www.gnu.org/licenses/>. */
int V1 = 0;
int I, X;
I = pile[v];
X = pile[v + 1];
v += 3;
V1 = I + 1;
c[v][I] = X;
J = V1;
v -= 3;
pile[v + 2] = J;
Of course, you can write your own Quine program (by definition they are outputting their own source code when being run) which generates a copyright notice.
You could study the copyright notices related to the LinuxFromScratch project. Many Linux distributions (e.g. Debian or Ubuntu) are self-building: with a big enough computer and weeks of your time, you can produce their
*.iso image, redistributable on various media (e.g. as LiveCD....)
Of course, copyright laws are different in France (where I live and work) and in the USA. Some French lawyers at work (one of them being an author of the CeCILL license) did told me that generated output at work can be copyrighted.
Your application might be a web service (under GPLv3), with your business model being IaaS. You would sell the access to the data, and publish its "specification" as open format. Read a lot more about open data, and the Big Other: Surveillance Capitalism and the Prospects of an Information Civilization and Simple Economics of Open Source papers.
Read also more about code obfuscation techniques.
Is there another option I'm not seeing?
Yes, using a code obfuscator. I don't say it is a good idea.
You might apply them to your program (e.g. redistribute some "obfuscated" variant of your source code). If your code is written in standard C11 and compiled by a recent GCC - e.g. GCC 10, writing your own GCC plugin which obfuscate your code is a matter of a few months of work. So (assuming you are legally allowed to do that) you could obfuscate all your source code and publish only its obfuscated variant.
Be however aware that it is likely that your program won't be used much, even if you open source it.
And most open source programs, even non-obfuscated, are rarely used. Most large open source programs (such as GCC or the Linux kernel - I am using Linux since 1993, and probably have used less than half of its source code lines - think of the countless drivers for hardware I never seen) have lots of code which is rarely used....
Philosophically and ethically, and for the FSF, obfuscated source code is not really source code anymore, but if you own it you could redistribute only an obfuscated variant. Legally obfuscated source code can obtain copyright protection.
(I spent 20 years of my career in writing professionally open source programs -funded, perhaps indirectly, by the European Union or the French Republic - that have in practice never been used, with the exception of my past contributions to GCC. Most open source code produced by computer science academics is almost never used in real life: most programming languages implementations have very few users outside of academia: did you ever use a program coded with Agda or GCC MELT? How many persons have you met using that programming language? But its implementation is open-source and developed by paid more or less academics)
How to enforce CC-BY in data generated by a program
By going to court when that data is mis-used. You'll have to pay a lawyer (or be one).