I’m sorry for necroing a thread that is over 6 years old, but I want to add that the comment marked “solution” will throw an error.
For an empty DataFrame
, bkamins’ first comment works, but for an unitialised DataFrame
of length N
, as explained in another thread, it’s far better to construct and populate the individual columns as length N
Vector
s first, then construct the DataFrame from these vectors.