1

So I have some data in a .Rdata-file. In this file there is a dataframe I'd like to use. It's called d. What I did to read it is the following:

> env = environment()
> load("data/Erfurt_rent_new.Rdata", envir = env)
> df = env$d

Then I wanted to access a column by typing df$..., but it immediately prompts me with:

Error in tolower(completions) : invalid multibyte string 6

I then tried to change the encoding od the columns. There are some german names in it and I thought this might be the problem. So I tried (as described here: link)

fix.encoding <- function(df, originalEncoding = "latin1") {
  numCols <- ncol(df)
  for (col in 1:numCols) Encoding(df[, col]) <- originalEncoding
  return(df)
}

But when I run it it says:

Error in `Encoding<-`(`*tmp*`, value = originalEncoding) : 
  a character vector argument expected

I then tried to change the default behaviour of stringsAsFactors = TRUE to FALSE by:

df1 = data.frame(df, stringsAsFactors = FALSE)

but then it says:

Error in make.names(vnames, unique = TRUE) : invalid multibyte string 6

So I'm a little lost. And all I'd like to do is read in my data;)

Lenn
  • 1,283
  • 7
  • 20
  • Please add a [minimal reproducible example](https://stackoverflow.com/a/5963610/4303162) to your question. Without having data that reproduces your problem, it is impossible to know for certain what is going wrong. – Stibu Apr 06 '20 at 14:08

0 Answers0