You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently this is what we have for DataFrame and Series:
library(polars)
options(polars.do_not_repeat_call=TRUE)
####### Seriesseries_vec=pl$Series(letters[1:3])
# output depends on datatypeseries_vec$to_r()
#> [1] "a" "b" "c"# identicalseries_vec$to_r_vector()
#> [1] "a" "b" "c"series_vec$to_vector()
#> [1] "a" "b" "c"# not identicalseries_vec$to_r_list()
#> [[1]]#> [1] "a"#> #> [[2]]#> [1] "b"#> #> [[3]]#> [1] "c"series_vec$to_list()
#> Error: Execution halted with the following contexts#> 1: $ - syntax error: to_list is not a method/attribute of the class RPolarsSeries####### DataFramedf=pl$DataFrame(x=letters[1:3])
# output depends on datatypedf$to_r()
#> Error: Execution halted with the following contexts#> 1: $ - syntax error: to_r is not a method/attribute of the class RPolarsDataFrame# not identicaldf$to_r_data_frame()
#> Error: Execution halted with the following contexts#> 1: $ - syntax error: to_r_data_frame is not a method/attribute of the class RPolarsDataFramedf$to_data_frame()
#> x#> 1 a#> 2 b#> 3 c# not identicaldf$to_r_list()
#> Error: Execution halted with the following contexts#> 1: $ - syntax error: to_r_list is not a method/attribute of the class RPolarsDataFramedf$to_list()
#> $x#> [1] "a" "b" "c"
I think we should have more consistency in the names of the methods:
remove the _r_ in the names of Series methods, so that we have to_r(), to_list() and to_vector(). That would be more consistent with to_data_frame() and to_list() that we have for DataFrame.
I'm even wondering if we should have to_r() for Series. When we use it we don't know the class of the output and I'm not sure we should allow that.
@eitsupi what do you think? Also, @grantmcdermott in case you want to participate (mostly about the second point)
The text was updated successfully, but these errors were encountered:
Agree.
I don't see the benefit of having more than one, so I think we need to remove some of them and encourage users to use the S3 method e.g. as.vector(), as.data.frame() instead of $to_vector(), $to_data_frame(). (i.e. should not use them on the document)
I really dislike not knowing at first glance whether the $to_data_frame() will be an RPolarsDataFrame or a data.frame, so I actually don't even have a problem with all these methods being private.
Currently this is what we have for
DataFrame
andSeries
:I think we should have more consistency in the names of the methods:
_r_
in the names of Series methods, so that we haveto_r()
,to_list()
andto_vector()
. That would be more consistent withto_data_frame()
andto_list()
that we have forDataFrame
.to_r()
for Series. When we use it we don't know the class of the output and I'm not sure we should allow that.@eitsupi what do you think? Also, @grantmcdermott in case you want to participate (mostly about the second point)
The text was updated successfully, but these errors were encountered: