Closed aylapear closed 1 year ago
Makes sense - unless file names can include characters that are not permitted in column names? If so I think we could drop the column name entirely
Do we want the file name to come from the x_name
(if supplied) and the column name to always come the x
argument?
I don't think that file names and column names have to the same rules on what they can be named. If we go with the x
argument then the column names would be restricted to only the rules for naming variables in R.
On reflection I think the column name could always just be x
as its not really adding any information beyond the file name. Ideally we wouldn't have any column name at all as the purpose is just to store a scalar value.
I when I say x
I mean the literal x
as opposed to the name of variable x.
Just to clarify I understand what you mean here are two examples.
Example 1 (x_name supplied):
y <- 1L
sbf_save_number(y, x_name = "var_name")
Then the file would be var_name.csv
and var_name.rds
and inside the csv we would have
x |
---|
1 |
Example 2 (no x_name):
y <- 1L
sbf_save_number(y)
Then the file would be y.csv
and y.rds
and inside the csv we would have
x |
---|
1 |
Yes exactly that!
Updated the pull request to this change
I assume that when
sbf_save_number()
creates the csv file it should create a column name based on the variable passed or thex_name
argument.It creates the column name as
x_name
even if anx_name
is passed.The rds file it creates is done correctly.