不久前(6个月以上),我看到一篇博文,其中作者拍摄了某人在互联网上发布的折线图,将图像输入到R中,并使用函数将图像转换为数据框.
我到处寻找,我似乎无法找到这篇博文(即使我确定我已将它加入书签).所以我想知道你们是否也读过这篇博文,或者有人知道一种快速简便的方法将线图转换为R中的数据框?
是这个吗?我搜索了"R数字化情节".使用的包是" ReadImages ".为了完整起见,列出的步骤是(见链接):
library(ReadImages) #Load package
mygraph <- read.jpeg('plot.jpg') #Import image
plot(mygraph) # Plot the image
calpoints <- locator(n=4,type='p',pch=4,col='blue',lwd=2) # Calibrate the plot by selecting known coordinates
data <- locator(type='p',pch=1,col='red',lwd=1.2,cex=1.2) # Collect the data points in a dataframe
Run Code Online (Sandbox Code Playgroud)