splitstackshape icon indicating copy to clipboard operation
splitstackshape copied to clipboard

unclear message when running cSplit()

Open yuliaUU opened this issue 3 years ago • 5 comments

I have written a code that uses cSplit function to separate a column in the data frame into multiple columns. Below is the reproducible example:

mtcars %>% rownames_to_column() %>% cSplit(., 'rowname', ' ')

Since I updated to R version 4.1.0. And after that the following code produces the following warning message that I was unable to resolve:

Warning messages:
1: In type.convert.default(X[[i]], ...) :
  'as.is' should be specified by the caller; using TRUE
2: In type.convert.default(X[[i]], ...) :
  'as.is' should be specified by the caller; using TRUE
3: In type.convert.default(X[[i]], ...) :
  'as.is' should be specified by the caller; using TRUE

I actually identified where the warning coming from: it is from the default value of type.convert=TRUE.

But I am not sure why it is producing the warning, and what I should do ( I do want the type.convert to be set to TUE)

yuliaUU avatar May 25 '21 01:05 yuliaUU

@yuliaUU Thanks for raising the issue. It appears to be related to changes to type.convert in R 4.1. Here's the relevant part from the release notes:

type.convert() now warns when its as.is argument is not specified, as the help file always said it should. In that case, the default is changed to TRUE in line with its change in read.table() (related to stringsAsFactor) in R 4.0.0.

I'll look into it shortly and try to get an update on CRAN. The warning should not affect the performance though.

mrdwab avatar May 25 '21 15:05 mrdwab

yes! the function works perfectly! Thanks a lot for your prompt response

yuliaUU avatar May 25 '21 15:05 yuliaUU

Just wanted to say that I also got the same error message. But as you said it is not affecting the execution of my code.

GaborioSensata avatar Jun 09 '21 20:06 GaborioSensata

A workaround if you don't need type conversion is to add the argument type.convert=FALSE.

ggrothendieck avatar Jul 27 '21 12:07 ggrothendieck

This warning still appears. Will we get a fix for this?

gernophil avatar Oct 17 '23 14:10 gernophil