comma bugs
Closed this issue · 2 comments
graemeblair commented
Some bugs from misplaced commas (see also DeclareDesign/DeclareDesign#175)
pop <- fabricate(
upper_level = add_level(
N = 50
),
lower_level = add_level(
N = 1,
)
)
pop()
> Error in nest_level_internal(N = N, ID_label = ID_label, working_environment_ = working_environment_, :
Nested data length for the variable "" appears to be incorrect. Nested data must either inherit the length N or be fixed-length variables equal to the total number of observations at the outer level. (In this case, 50). Variable supplied was length 0
pop <- fabricate(
upper_level = add_level(
N = 50,
),
lower_level = add_level(
N = 1
)
)
pop()
> Error in add_level_internal(N = N, ID_label = ID_label, working_environment_ = working_environment_, :
All variables inside an add_level call must be named.
nfultz commented
Also these are/should be syntax errors a la
```
sample(,)Error in sample(, ) : argument "x" is missing, with no default
```
but the NSE is obfuscating where the error actually is occurring. We should
print the outer call ( `add_level(N=50,)` ), not the internal.
…On Wed, Apr 25, 2018 at 2:15 PM, Graeme Blair ***@***.***> wrote:
Some bugs from misplaced commas (see also DeclareDesign/DeclareDesign#175
<DeclareDesign/DeclareDesign#175>)
pop <- fabricate(
upper_level = add_level(
N = 50
),
lower_level = add_level(
N = 1,
)
)
pop()
> Error in nest_level_internal(N = N, ID_label = ID_label, working_environment_ = working_environment_, :
Nested data length for the variable "" appears to be incorrect. Nested data must either inherit the length N or be fixed-length variables equal to the total number of observations at the outer level. (In this case, 50). Variable supplied was length 0
pop <- fabricate(
upper_level = add_level(
N = 50,
),
lower_level = add_level(
N = 1
)
)
pop()
> Error in add_level_internal(N = N, ID_label = ID_label, working_environment_ = working_environment_, :
All variables inside an add_level call must be named.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#123>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAZjTmPBGzg0Iqcr6IkRlKielWnQirjrks5tsOeJgaJpZM4TkKxN>
.
aaronrudkin commented
Both types of bug are closed in the commit I just made with pretty good warning messages (good detail on which variable wasn't named, and a special case for the hanging comma at the end.) I also added the check in nest/modify. Tests are also commited with this commit. Close when merged.