Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.(5)

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

ITtutoria

ITtutoria Logo ITtutoria Logo

ITtutoria Navigation

  • Python
  • Java
  • Reactjs
  • JavaScript
  • R
  • PySpark
  • MYSQL
  • Pandas
  • QA
  • C++
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA
Home/ Questions/Quick handling of the unimplemented type 'list' in 'encodeelement' error
Next
Answered
Phoenix Tremblay
  • 9
Phoenix Tremblay
Asked: May 18, 20222022-05-18T20:28:11+00:00 2022-05-18T20:28:11+00:00In: r

Quick handling of the unimplemented type ‘list’ in ‘encodeelement’ error

  • 9

. Advertisement .

..3..

. Advertisement .

..4..

Here is the program I run:

> head(output)
  Id Title IsProhibited
 1 10000074 Renault Logan, 2005 0
 2 10000124 Ñêëàäñêîå ïîìåùåíèå, 345 ì<U+00B2> 0
 3 10000175 Ñó-øåô 0
 4 10000196 3-ê êâàðòèðà, 64 ì<U+00B2>, 3/5 ýò. 0
 5 10000387 Samsung galaxy S4 mini GT-I9190 (÷¸ðíûé) 0
 6 10000395 Êàðòèíà ""Êðûì. Ïîñåëîê Àðîìàò"" (õîëñò, ìàñëî) 0
> write.table(output, 'output.csv', sep = ',', row.names = FALSE, append = T)
toString(output$Title)
> class(output)
 [1] "data.frame"
 > class(output$Id)
 [1] "integer"
 > class(output$Title)
 [1] "list"
 > class(output$IsProhibited)
 [1] "factor"
> output$Title[0:3]
 [[1]]
 [1] "Renault Logan, 2005"
 
 [[2]]
 [1] "Складское помещение, 345 м²"
 
 [[3]]
 [1] "Су-шеф"
Id Title IsProhibited 
 10000074 Renault Logan, 2005 0 
 10000124 СкладÑкое помещение, 345 м<U+00B2> 0 
 10000175 Су-шеф 0 
 10000196 3-к квартира, 64 м<U+00B2>, 3/5 ÑÑ‚. 0 
 10000387 Samsung galaxy S4 mini GT-I9190 (чёрный) 0 
 10000395 Картина "Крым. ПоÑелок Ðромат"" (холÑÑ‚ маÑло)" 0
 10000594 КальÑн 25 Ñм 0 
 10000612 1-к квартира, 45 м<U+00B2>, 6/17 ÑÑ‚. 0 
 10000816 Гараж, 18 м<U+00B2> 0 
 10000831 Платье 0 
 10000930 Карбюраторы К-22И, К-22Г от газ 21 и газ 51 0

After I run, it returns an error:

Error in .External2(C_writetable, x, file, nrow(x), p, rnames, sep, eol, : 
 unimplemented type 'list' in 'EncodeElement'
 In addition: Warning message:
 In write.table(output, "output.csv", sep = ",", row.names = FALSE, :
  appending column names to file

Does anyone have any suggestions for the problem below: unimplemented type ‘list’ in ‘encodeelement’ in the r. How to correct it?

dataframe
  • 2 2 Answers
  • 453 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook
  • Report

2 Answers

  • Voted
  • Oldest
  • Recent
  • Random
  1. Best Answer
    dttutoria Expert
    2022-06-25T09:09:48+00:00Added an answer on June 25, 2022 at 9:09 am

    The cause: When you provide a list to a function that needs a vector, this error unimplemented type ‘list’ in ‘encodeelement’ occurs.

    Solution:

    You may do the following to obtain your list as a character vector:

    output$Title <- vapply(output$Title, paste, collapse = ", ", character(1L))

    If you were interested in trying with the unlist method, you could “expand” every other row by the distinct values in output$Title, as seen below:

    x <- vapply(output$Title, length, 1L) ## How many items per list element
    output <- output[rep(rownames(output), x), ] ## Expand the data frame
    output$Title <- unlist(output$Title, use.names = FALSE) ## Replace with raw values
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. Chloë Marchal
    2022-05-25T21:05:40+00:00Added an answer on May 25, 2022 at 9:05 pm

    This is regardless of how many columns are available:

    df <- apply(df,2,as.character)

    write.csv is your next step

    • 15
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question
  • How to Split String by space in C++
  • How To Convert A Pandas DataFrame Column To A List
  • How to Replace Multiple Characters in A String in Python?
  • How To Remove Special Characters From String Python

Explore

  • Home
  • Tutorial

Footer

ITtutoria

ITtutoria

This website is user friendly and will facilitate transferring knowledge. It would be useful for a self-initiated learning process.

@ ITTutoria Co Ltd.

Tutorial

  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA

Legal Stuff

  • About Us
  • Terms of Use
  • Privacy Policy
  • Contact Us

DMCA.com Protection Status

Help

  • Knowledge Base
  • Support

Follow

© 2022 Ittutoria. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.