我正在根据另一个变量的字符串条件填充数据帧的新变量。我收到以下错误消息:
Error in Source == "httpWWW.BGDAILYNEWS.COM" | Source == :
operations are possible only for numeric, logical or complex types
我的代码如下:
County <- ifelse(Source == 'httpWWW.BGDAILYNEWS.COM' | 'WWW.BGDAILYNEWS.COM', 'Warren',
ifelse(Source == 'httpWWW.HCLOCAL.COM' | 'WWW.HCLOCAL.COM', 'Henry',
ifelse(Source == 'httpWWW.KENTUCKY.COM' | 'WWW.KENTUCKY.COM', 'Fayette',
ifelse(Source == 'httpWWW.KENTUCKYNEWERA.COM' | 'WWW.KENTUCKYNEWERA.COM', 'Christian')
)))