I have been trying to import the file
reuters <- Corpus(DirSource(directory = "E:\\R Programs\\Test\\Reuteurs\\reut2-000.xml", encoding = "UTF-8"),
readerControl = list(reader = readReut21578XMLasPlain))
However I get below error:
Error in DirSource(directory = "E:\\R Programs\\Test\\Reuteurs\\reut2-000.xml", :
empty directory
I have also checked other solutions provide in stackoverflow but its not working for me. Am I missing anything?
But below code works: Why DirSource method is not working for me? Am I missing anything?
reuters <- Corpus(URISource("file://E:\\R Programs\\Test\\Reuteurs\\reut2-000.xml",encoding="UTF-8"),
readerControl = list(reader = readReut21578XMLasPlain))
Reference link which I referred:
R: Got problems in reading text file
reut2-000.xml
probably is a file, and not a directory?
Opening a file as directory will cause an error.