0

I basically want to perform the below Python operation, but in R

train['annotation']=train['annotation'].apply(eval)

So, I tried this:

train$annotation <- lapply(train$annotation, eval)

However, I am getting incorrect output. The output in Python for the annotation column is:

enter image description here

And in R, I am getting:

enter image description here

What is wrong with my R code?

MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Please [do not post code or data in images](https://meta.stackoverflow.com/q/285551/2372064) – MrFlick Apr 21 '23 at 19:12
  • 1
    Maybe you want `sapply` rather than `lapply`? Had to say without seeing the data. – MrFlick Apr 21 '23 at 19:13
  • Yes, sapply worked! Thank you! – Sanika Kalvikatte Apr 21 '23 at 19:15

0 Answers0