What does this error mean?

Error in type.convert.default(data[[i]], as.is = as.is[i], dec = dec, :
invalid multibyte string at '-1

Hi, welcome to the forum.

I think we need a bit more information. At least we need the code you were running at the time you got the error message and what data you were using. Essentially,we need a FAQ: How to do a minimal reproducible example ( reprex ) for beginners

A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need.

It would be very be very helpful if you could supply the output of

 sessionInfo()

since it looks like an encoding problem.

Hello, thank you.
I was importing a .csv file then I encountered the error. The command X <-read.csv is importing other files when I try it but not the one I want to work with. It contains counties which I geocoded on a website on the internet. I would like to plot them using R studio but I just don't know how to go about it.

Hi,

I think we still need at least the output of

 sessionInfo()

and the actual code you are using
Just copy the code and paste it between three ` like this

```
dat1  <- import("rows.csv")

write.xlsx(dat1, "cath1.xlsx", sheetName="Sheet1", col.names=TRUE, row.names= FALSE, append=FALSE, showNA=TRUE, password= "Casper")

dat2  <- read.xlsx("cath1.xlsx", sheetName="Sheet1", password= "Casper")

```

If you open the .csv file in a text editor does in look like there are any non-ascii characters in it. Something as simple as é or ô or perhaps a Chinese ideogram?

Here is the code:
Data1 <- read.csv("QualitativeAnalysis.CSV")
here is the error:

Data1 <- read.csv("QualitativeAnalysis.CSV")
Error in type.convert.default(data[[i]], as.is = as.is[i], dec = dec, :
invalid multibyte string at '-1.'


jrkrideau

1d

Hi,

I think we still need at least the output of

 sessionInfo()

sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8
[2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_4.2.1 tools_4.2.1

R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8
[2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_4.2.1 tools_4.2.1

library("sf", "tmap", "tidygeocoder")
Linking to GEOS 3.9.1, GDAL 3.4.3, PROJ 7.2.1; sf_use_s2() is TRUE
Warning message:
In library("sf", "tmap", "tidygeocoder") :
‘tidygeocoder’ not found on search path, using pos = 2
sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8
[2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] sf_1.0-8

loaded via a namespace (and not attached):
[1] Rcpp_1.0.8.3 magrittr_2.0.3 units_0.8-0
[4] tidyselect_1.1.2 R6_2.5.1 rlang_1.0.2
[7] fansi_1.0.3 dplyr_1.0.9 tools_4.2.1
[10] grid_4.2.1 KernSmooth_2.23-20 utf8_1.2.2
[13] cli_3.3.0 e1071_1.7-11 DBI_1.1.2
[16] ellipsis_0.3.2 class_7.3-20 assertthat_0.2.1
[19] tibble_3.1.7 lifecycle_1.0.1 crayon_1.5.1
[22] purrr_0.3.4 vctrs_0.4.1 glue_1.6.2
[25] proxy_0.4-26 compiler_4.2.1 pillar_1.7.0
[28] generics_0.1.2 classInt_0.4-3 pkgconfig_2.0.3

Hi @Tesla

Thanks. I was expecting to see an encoding issue but unless I am misreading the output your system is using UtF-8 and this should be fine.

The worrying thing is the message "tidygeocoder") :
‘tidygeocoder’ not found on search path,

I am just guessing here but you may need to install tidygeocoder.

Other than that we probably need someone who knows a lot more about the "sf" package than I do.