-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq2_notes.R
More file actions
70 lines (38 loc) · 1.17 KB
/
q2_notes.R
File metadata and controls
70 lines (38 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# MySQL
library(RMySQL)
hg19 <- dbConnect(MySQL(),user="genome",db="hg19",host="genome-mysql.cse.ucsc.edu")
allTables <- dbListTables(hg19)
length(allTables)
dbDisconnect(ucscDb)
df<-dbGetQuery(hg19,"select * form ...")
df<-dbReadTable(hg19,'some table')
query<-dbSendQuery(hg19,"select * from ... where...")
affMis<- fetch(query,n=100)
dbClearResult(query)
quantile(affyMiss$some_field)
# HDF5
library(rhdf5)
create = h5createFile("example.h5")
created = h5createGroup("example.h5","foo")
created = h5createGroup("example.h5","bar")
h5write(A,"example.h5","foo/A")
h5write(df,"example.h5","df")
h5write(c(12,13,14),"example.h5","foo/A",index=list(1:3,1))
h5read("example.h5","foo/A")
h5ls("example.h5")
# Web
con = url("....")
htmlCode = readLines(con)
close(con)
library(XML)
html<-htmlTreeParse(url, useInternalNodes=1)
xpathSApply(html,"//title",xmlValue)
xpathSApply(html,"//td[@id='col-citedby']",xmlValue)
library(httr)
html <- GET(url,authenticate("user","passwd"))
content<-content(html,as="text")
parsedHtml <- htmlParse(content,asText=TRUE)
xpathSApply(parsedHtml,'//title',xmlValue)
google <- handle("http://google.com")
html <- GET(google,path="/")
# API