Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rxDataStep cannot change type of existing variable #49

Open
hongooi73 opened this issue Jul 26, 2017 · 2 comments
Open

rxDataStep cannot change type of existing variable #49

hongooi73 opened this issue Jul 26, 2017 · 2 comments

Comments

@hongooi73
Copy link
Contributor

Even when writing to a new file:

> mtx <- rxDataStep(mtcars, "mtcars.xdf", overwrite=TRUE)

> z <- rxDataStep(mtx, "mtcarsz.xdf", transforms=list(am=as.character(am)), overwrite=TRUE)

> rxGetVarInfo(z)
Var 1: mpg, Type: numeric, Low/High: (10.4000, 33.9000)
Var 2: cyl, Type: numeric, Low/High: (4.0000, 8.0000)
Var 3: disp, Type: numeric, Low/High: (71.1000, 472.0000)
Var 4: hp, Type: numeric, Low/High: (52.0000, 335.0000)
Var 5: drat, Type: numeric, Low/High: (2.7600, 4.9300)
Var 6: wt, Type: numeric, Low/High: (1.5130, 5.4240)
Var 7: qsec, Type: numeric, Low/High: (14.5000, 22.9000)
Var 8: vs, Type: numeric, Low/High: (0.0000, 1.0000)
Var 9: am, Type: numeric, Low/High: (0.0000, 1.0000)  <--- wrong
Var 10: gear, Type: numeric, Low/High: (3.0000, 5.0000)
Var 11: carb, Type: numeric, Low/High: (1.0000, 8.0000)
@hongooi73
Copy link
Contributor Author

This only seems to affect numeric -> character. Transforming character -> numeric works:

> out <- rxDataStep(mtx, "temp.xdf", transforms=list(a=as.character(seq_len(.rxNumRows))))
> rxGetVarInfo(out)
...
Var 12: a, Type: character

> out2 <- rxDataStep(out, "temp2.xdf", transforms=list(a=as.numeric(a)))
> rxGetVarInfo(out2)
...
Var 12: a, Type: numeric, Low/High: (1.0000, 32.0000)

@hongooi73
Copy link
Contributor Author

TFS item 78049

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant