使用 sqldf 按分隔符解析

Parse By Delimitor with sqldf

我有如下数据框:

df
   ColA    ColB
  New|ME      7
 New|You      8
     ten      9
Aim|High     10

预期输出:

   ColA    ColB    First   Second
  New|ME      7      New       ME
 New|You      8      New      You
     ten      9      ten       NA
Aim|High     10      Aim     High

如何通过分隔符使用 sqldf 解析 ColA |

这是我的尝试,但我收到了一个错误:

library(sqldf)
df1<- sqldf("SELECT * FROM df CROSS APPLY STRING_SPLIT([ColA], '|') ")

Error in result_create(conn@ptr, statement) : near "(": syntax error
df <- sqldf("SELECT *, SUBSTR([ColA], 1, INSTR([ColA],'|')-1) First FROM df")
df <- sqldf("SELECT *, SUBSTR([ColA], INSTR([ColA],'|')+1, Length([ColA])) Second FROM df")
df <- sqldf("SELECT ColA, ColB, First, Second FROM df")