Data can be
read/write to external world using connection interfaces, By using connection
interface, you can read/write data from/to a file, url etc.,
file : Opens
connection to a file
gzfile : Opens
connection to a file compressed with gzip
bzfile : Opens
connection to a file compressed with bzip2
xzfile : Opens
connection to a file compressed with xz
url : Opens
connection to a webpage
Read data from URL
url.show("https://self-learning-java-tutorial.blogspot.com")
Above statement download content from given url and display the data in separate window.
Above statement download content from given url and display the data in separate window.
> url.show("https://self-learning-java-tutorial.blogspot.com") trying URL 'https://self-learning-java-tutorial.blogspot.com' Content type 'text/html; charset=UTF-8' length unknown .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .. downloaded 252 KB
Another way to read from URL
> con <- url("https://self-learning-java-tutorial.blogspot.com", "r") > > x <- readLines(con) Warning message: > > head(x) [1] "<!DOCTYPE html>" [2] "<html class='v2' dir='ltr' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>" [3] "<head>" [4] "<meta content='width=1100' name='viewport'/>" [5] "<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>" [6] "<script type=\"text/javascript\">(function() { var b=window,f=\"chrome\",g=\"tick\",k=\"jstiming\";(function(){function d(a){this.t={};this.tick=function(a,d,c){var e=void 0!=c?c:(new Date).getTime();this.t[a]=[e,d];if(void 0==c)try{b.console.timeStamp(\"CSI/\"+a)}catch(h){}};this[g](\"start\",null,a)}var a;b.performance&&(a=b.performance.timing);var n=a?new d(a.responseStart):new d;b.jstiming={Timer:d,load:n};if(a){var c=a.navigationStart,h=a.responseStart;0<c&&h>=c&&(b[k].srt=h-c)}if(a){var e=b[k].load;0<c&&h>=c&&(e[g](\"_wtsrt\",void 0,c),e[g](\"wtsrt_\",\"_wtsrt\",h),e[g](\"tbsd_\",\"wtsrt_\"))}try{a=null,"
No comments:
Post a Comment