-
Notifications
You must be signed in to change notification settings - Fork 14
/
.Rapp.history
443 lines (443 loc) · 13.8 KB
/
.Rapp.history
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
units(test)
60*60*10
library(ncdf4)
gribfile <- "http://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cfsv2_forecast_ts_9mon/2011/201104/20110401/2011040100/tmax.01.2011040100.daily.grb2"
nc <- nc.open(gribfile)
nc <- nc_open(gribfile)
gribfile <- "http://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cfsv2_forecast_ts_9mon/2011/201104/20110401/2011040100/tmax.01.2011040100.daily.grb2.nc"
nc <- nc_open(gribfile)
gribfile <- "https://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cfsv2_forecast_ts_9mon/2011/201104/20110401/2011040100/tmax.01.2011040100.daily.grb2.nc"
nc <- nc_open(gribfile)
gribfile <- "https://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cfsv2_forecast_ts_9mon/2011/201104/20110401/2011040100/tmax.01.2011040100.daily.grb2"
nc <- nc_open(gribfile)
str(nc)
nc_close(nc)
library(orcutt)
price<-c( 0.27, 0.28, 0.28, 0.28, 0.27, 0.26, 0.28 ,0.27 ,0.26 ,0.28, 0.28 ,0.27, 0.27, 0.29, 0.28,0.29, 0.28, 0.2 cons<-c(0.39, 0.37, 0.39, 0.42, 0.41, 0.34, 0.33, 0.29, 0.27, 0.26, 0.29 ,0.30, 0.33, 0.32, 0.38,0.38, 0.47, 0.44, income<-c(78, 79, 81, 80 ,76 ,78, 82, 79, 76, 79, 82, 85, 86, 83, 84, 82, 80, 78, 84, 86, 85, 87, 94, 92, 95, 96, 94 temp<-c(41,56,63,68,69,65,61,47,32,24,28,26,32,40,55,63,72,72,67,60,44,40,32,27,28,33,41,52,64,71) reg<-lm(cons~price+income+temp) reg2<-cochrane.orcutt(reg) reg2
?orcutt
price<-c( 0.27, 0.28, 0.28, 0.28, 0.27, 0.26, 0.28 ,0.27 ,0.26 ,0.28, 0.28 ,0.27, 0.27, 0.29, 0.28,0.29, 0.28, 0.28, 0.28, 0.28, 0.29, 0.29, 0.28, 0.28, 0.28, 0.26, 0.26 ,0.26, 0.27 ,0.26)#
cons<-c(0.39, 0.37, 0.39, 0.42, 0.41, 0.34, 0.33, 0.29, 0.27, 0.26, 0.29 ,0.30, 0.33, 0.32, 0.38,0.38, 0.47, 0.44, 0.39, 0.34, 0.32, 0.31, 0.28, 0.33, 0.31, 0.36, 0.38 ,0.42, 0.44 ,0.55)#
income<-c(78, 79, 81, 80 ,76 ,78, 82, 79, 76, 79, 82, 85, 86, 83, 84, 82, 80, 78, 84, 86, 85, 87, 94, 92, 95, 96, 94, 96, 91, 90)#
temp<-c(41,56,63,68,69,65,61,47,32,24,28,26,32,40,55,63,72,72,67,60,44,40,32,27,28,33,41,52,64,71)#
reg<-lm(cons~price+income+temp)#
reg2<-cochrane.orcutt(reg)#
reg2
library(orcutt)
?orcutt
price<-c( 0.27, 0.28, 0.28, 0.28, 0.27, 0.26, 0.28 ,0.27 ,0.26 ,0.28, 0.28 ,0.27, 0.27, 0.29, 0.28,0.29, 0.28, 0.28, 0.28, 0.28, 0.29, 0.29, 0.28, 0.28, 0.28, 0.26, 0.26 ,0.26, 0.27 ,0.26)#
cons<-c(0.39, 0.37, 0.39, 0.42, 0.41, 0.34, 0.33, 0.29, 0.27, 0.26, 0.29 ,0.30, 0.33, 0.32, 0.38,0.38, 0.47, 0.44, 0.39, 0.34, 0.32, 0.31, 0.28, 0.33, 0.31, 0.36, 0.38 ,0.42, 0.44 ,0.55)#
income<-c(78, 79, 81, 80 ,76 ,78, 82, 79, 76, 79, 82, 85, 86, 83, 84, 82, 80, 78, 84, 86, 85, 87, 94, 92, 95, 96, 94, 96, 91, 90)#
temp<-c(41,56,63,68,69,65,61,47,32,24,28,26,32,40,55,63,72,72,67,60,44,40,32,27,28,33,41,52,64,71)#
reg<-lm(cons~price+income+temp)#
reg2<-cochrane.orcutt(reg)
reg
reg2
summary(reg)
library(xtractomatic)
citation(xtractomatic)
citation("xtractomatic")
?xtractomatic
library(IgorR)
?IgorR
junk = read.pxp('/Users/rmendels/WorkFiles/65n_fourier.pxp', ReturnTimeSeries = TRUE)
str(junk)
str(junk$common_season12_10)
plot(junk$common_season12_10)
plot(junk$common_trend_1)
sin(0)
sin(1)
?saveRDS
library(TSclust)
?TSclust
data(interest.rates)
trans.inter.rates <- log(interest.rates[2:215,]) - log(interest.rates[1:214,])
str(trans.inter.rates)
?diss
myDist <- diss(trans.inter.rates,METHOD="DTWARP")
library(ggplot2)
library(plotly)
set.seed(100)#
d <- diamonds[sample(nrow(diamonds), 1000), ]#
plot_ly(d, x = ~carat, y = ~price, color = ~carat,#
size = ~carat, text = ~paste("Clarity: ", clarity))
p <- ggplot(data = d, aes(x = carat, y = price)) +#
geom_point(aes(text = paste("Clarity:", clarity))) +#
geom_smooth(aes(colour = cut, fill = cut)) + facet_wrap(~ cut)
p
ggplotly(p)
library(ggiraph)
?ggiraph
data("GlobalTemp") model_temp <- SSModel(GlobalTemp ~ SSMtrend(1, Q = NA, type = "common"), H = matrix(NA, 2, 2)) # Estimating the variance parameters inits <- chol(cov(GlobalTemp))[c(1, 4, 3)] inits[1:2] <- log(inits[1:2]) fit_temp <- fitSSM(model_temp, c(0.5*log(.1), inits), method = "BFGS") out_temp <- KFS(fit_temp$model) ts.plot(cbind(model_temp$y, coef(out_temp)), col = 1:3) legend("bottomright", legend = c(colnames(GlobalTemp), "Smoothed signal"), col = 1:3, lty = 1)
library(KFAS)
data("GlobalTemp") model_temp <- SSModel(GlobalTemp ~ SSMtrend(1, Q = NA, type = "common"), H = matrix(NA, 2, 2)) # Estimating the variance parameters inits <- chol(cov(GlobalTemp))[c(1, 4, 3)] inits[1:2] <- log(inits[1:2]) fit_temp <- fitSSM(model_temp, c(0.5*log(.1), inits), method = "BFGS") out_temp <- KFS(fit_temp$model) ts.plot(cbind(model_temp$y, coef(out_temp)), col = 1:3) legend("bottomright", legend = c(colnames(GlobalTemp), "Smoothed signal"), col = 1:3, lty = 1)
library(rerddap)
sardines <- tabledap(#
'FRDCPSTrawlLHHaulCatch',#
fields = c('latitude', 'longitude', 'time', 'scientific_name', 'subsample_count'),#
'time>=2010-01-01', 'time<=2012-01-01', 'scientific_name="Sardinops sagax"'#
)
p <- plotdap()
add_tabledap(p, sardines, ~subsample_count)
add_tabledap(p, sardines, ~log(subsample_count))
p <- plotdap(crs = "+proj=robin")
add_tabledap(p, sardines, ~subsample_count)
murSST <- griddap(#
'jplMURSST41', latitude = c(22, 51), longitude = c(-140, -105),#
time = c('last', 'last'), fields = 'analysed_sst'#
)
p <- plotdap(crs = "+proj=robin")
add_griddap(p, murSST, ~analysed_sst)
murSST <- griddap(#
'jplMURSST41', latitude = c(22, 51), longitude = c(-140, -105),#
time = c('last', 'last'), fields = 'analysed_sst'#
)
str(murSST)
p <- plotdap()
add_griddap(p, murSST, ~analysed_sst)
help(.Rprofile)
library(rerddap)#
url <- "http://upwell.pfeg.noaa.gov/erddap/"#
myinfo <- info( datasetid = "esrlNcepRe_LonPM180"#
, url = url#
)
myinfo
x <- griddap( myinfo#
, time = c( "2015-07-01T00:00:00Z", "2015-07-02T00:00:00Z" )#
, latitude = c( 35, 37 )#
, longitude = c( -117, -115 )#
, fmt = "csv"#
)
str(x)
library(DT)#
datatable(iris)
library(DT)
datatable(iris)
View(iris)
datatable(iris)
f <- function() {#
x <- 1#
y <- 2#
c(x, y)#
}#
f()
rm(f)
x <- 2#
g <- function() {#
y <- 1#
c(x, y)#
}#
g()
x <- 1#
h <- function() {#
y <- 2#
i <- function() {#
z <- 3#
c(x, y, z)#
}#
i()#
}#
h()
j <- function(x) {#
y <- 2#
function() {#
c(x, y)#
}#
}#
k <- j(1)#
k()
?runif
?outer
x <- 1:9; names(x) <- x
x %o% x
outer(month.abb, 1999:2003, FUN = "paste")
str(month.abb)
?sprintf
library(rerddap)
pacakageVersion("rerddap")
packageVersion("rerddap")
plotdap()
library(rerddap)#
dataInfo <- rerddap::info('hawaii_d90f_20ee_c4cb')#
xpos <- c(135.25, 240.25)#
ypos <- c(20.25, 60.25)#
zpos <- c(70.02, 70.02)#
tpos <- c('2010-12-15', '2010-12-15')#
soda70 <- griddap(dataInfo, longitude = xpos, latitude = ypos, time = tpos, depth = zpos, fields = 'temp' )
soda70$data$lon <- soda70$data$lon - 360
junk <- soda70$data
str(junk)
is.factor(soda70$data$time)
devtools::install_github("edzer/sfr")
?library
library(lubridate)
?yday
library(matplot)
library(plotdap)
sstInfo <- info('jplMURSST41')
murSST <- griddap(sstInfo, latitude = c(22., 51.), longitude = c(-140., -105), time = c('last','last'), fields = 'analysed_sst')
add_griddap(plotdap(), murSST, ~analysed_sst, maxpixels = 50000)
library(ncdf4)
myURL - 'http://kyrill.ias.sdsmt.edu:8080/thredds/dodsC/testAll/TSA_RCP85_CONUS_1920-2100.nc4'
myURL <- 'http://kyrill.ias.sdsmt.edu:8080/thredds/dodsC/testAll/TSA_RCP85_CONUS_1920-2100.nc4'
junk <- nc_open(myURL)
str(junk)
Sys.timezone()
library(raster)#
library(sf)#
library(ggplot2)#
#
f <- system.file("external/test.grd", package="raster")#
r <- raster(f)#
s <- st_as_sf(rasterToPolygons(r))#
ggplot() + geom_sf(data = s, aes(fill = test), colour = "transparent")
library(sf)
?sf_transform
?st_transform
library(rerddap)
library(plotdap)
library)ggplot2
library(ggplot2)
sardines <- tabledap(#
'FRDCPSTrawlLHHaulCatch',#
fields = c('latitude', 'longitude', 'time', 'scientific_name', 'subsample_count'),#
'time>=2010-01-01', 'time<=2012-01-01', 'scientific_name="Sardinops sagax"'#
)
add_tabledap(#
plotdap(), #
sardines, #
~subsample_count#
)
buoy <- tabledap(#
'cwwcNDBCMet', #
fields=c('latitude', 'longitude', 'time', 'wtmp'), #
'time=2017-08-01T19:00:00Z', #
'latitude>=36.5','latitude<=38.55', 'longitude>=-123.5','longitude<=-121.5',#
'wtmp>0'#
)
buoy
sardines
add_tabledap(plotdap("base"), buoy, ~as.numeric(wtmp))
library(ggplot2)
library(gapminder)
library(gganimate)
p <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, color = continent, frame = year)) +#
geom_point() +#
scale_x_log10()
gganimate(p)
library(gapminder)#
library(ggplot2)#
theme_set(theme_bw())
p <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, color = continent, frame = year)) +#
geom_point() +#
scale_x_log10()
library(gganimate)#
#
gganimate(p)
system("export PATH=/sw/bin:$PATH")
gganimate(p)
library(devtools)
?devtools
gganimate(p)
library(goodpractice)
gp(path = "/Users/rmendels/WorkFiles/rerddap")
?plotBox
covr::package_coverage()
?covr
library(xtactomatic)
library(xtractomatic)
extract <- xtracto(tagData$lon[1:3], tagData$lat[1:3], tagData$date[1:3], "ETOPO360", 0. , 0.)
tagData <- Marlintag38606
extract <- xtracto(tagData$lon[1:3], tagData$lat[1:3], tagData$date[1:3], "ETOPO360", 0. , 0.)
str(extract)
extract <- xtracto(tagData$lon[1:3], tagData$lat[1:3], tagData$date[1:3], "ETOPO360", 0. , 0., verbose = TRUE)
library(rerddap)
urlbase <- 'https://upwell.pfeg.noaa.gov/erddap'#
dataInfo <- rerddap::info('erdMBsstd8day')#
parameter <- 'sst'#
xcoord <- c(230, 231)#
ycoord <- c(40, 41)#
tcoord <- c('2006-01-15', '2006-01-20')#
zcoord <- c(0., 0.)#
xlen <- 0.5#
ylen <- 0.5#
extract <- rxtracto(dataInfo, parameter = parameter, xcoord = xcoord,#
ycoord = ycoord, tcoord= tcoord, zcoord = zcoord,#
xlen = xlen, ylen = ylen)
library(rerddapXtracto)
extract <- rxtracto(dataInfo, parameter = parameter, xcoord = xcoord,#
ycoord = ycoord, tcoord= tcoord, zcoord = zcoord,#
xlen = xlen, ylen = ylen)
str(extract)
devtools::install_github("helske/bssm")
devtools::install_github("eliocamp/metR")
library(ncdf4)
?ncvar_get
180/pi
devtools::install_github("ropensci/git2r")
devtools::install_github("seananderson/glmmfields")
library(gridExtra)
?grid.arrange
library(sf)
wd <- st_as_sf(maps::map('world', plot = FALSE, fill = TRUE))
wd <- st_transform(wd, st_crs("+proj=robin"))
st_graticule(wd)
library(rerddap)
install.packages('curl')
library(rerddap)
?rerddap
browseURL("https://www.r-project.org")
devtools::install_github("james-thorson/VAST", INSTALL_opts="--no-staged-install")
library(rgeos)
?rgeos
??rgeos
spgeom()
gArea()
dummy <- function() rgeos::getScale()
?crs
?try_require
load("/Users/rmendels/WorkFiles/Bakun_Kiefer/sst_model_phase.RData")
ls()
str(sst_model_phase_kernel_smooth)
library(rnoaa)
gefs_latitudes()
gefs_longitudes()
lat <- 46.28125#
lon <- -118.2188
forecast <- gefs("Total_precipitation_surface_6_Hour_Accumulation_ens",#
lat, lon, ens = 0, time = 12)
library(rnoaa)
library(sp)
data(meuse)
data(meuse.grid)
str(meuse.grid)
str(meuse)
library(sp)
data(meuse)
str(meuse)
date(meuse.grid)
data(meuse.grid)
str(meuse.grid)
zoop <- deriv(expression((-0.0263*B)+(0.0010*B^2)),"B",func=TRUE)
zoop
library(ncdf4)
library(rerddap)
info <- ('nesdisVHNSQchlaMonthly', url = 'https://coastwatch.pfeg.noaa.gov/erddap/')
junk <- info('nesdisVHNSQchlaMonthly', url = 'https://coastwatch.pfeg.noaa.gov/erddap/')
str(junk)
plot(1:10)
quartz()#
plot(1:10)
library(rerddap)
result <- griddap('noaa_psl_7072_e40a_a07a', #
time = c('1983-01-01', '1983-01-04'),#
x = c(844038, 1103742),#
y = c(6135507, 6297822),#
fields ='quflux'#
)
result <- griddap('noaa_psl_7072_e40a_a07a', #
time = c('1983-01-01', '1983-01-04'),#
x = c(844038, 1103742),#
y = c(6135507, 6297822),#
fields ='all'#
)
out <- info('erdVHNchlamday')
res <- griddap('erdVHNchlamday',#
time = c('2015-04-01','2015-04-10'),#
latitude = c(18, 21),#
longitude = c(-120, -119)#
)
result <- griddap(out, #
time = c('1983-01-01', '1983-01-04'),#
x = c(844038, 1103742),#
y = c(6135507, 6297822),#
fields ='all'#
)
str(out)
ibrary(buildmer)#
library(lme4)#
#
nrow <- 100#
#
test <- data.frame(x01=runif(nrow),#
y=runif(nrow)<.1, block=as.factor(floor((1:nrow)/50)))#
head(test)#
fit.model <- lme4::glmer(y~x01 + (1|block), data=test,#
family=binomial(link="logit"))#
fit.model # this works#
#
class(fit.model)#
#
summary(fit.model)
library(buildmer)#
library(lme4)#
#
nrow <- 100#
#
test <- data.frame(x01=runif(nrow),#
y=runif(nrow)<.1, block=as.factor(floor((1:nrow)/50)))#
head(test)#
fit.model <- lme4::glmer(y~x01 + (1|block), data=test,#
family=binomial(link="logit"))#
fit.model # this works#
#
class(fit.model)#
#
summary(fit.model)
install.packages("INLA",repos=c(getOption("repos"),INLA="https://inla.r-inla-download.org/R/stable"), dep=TRUE)
library(ggplot2)#
#
linedata<- data.frame(#
PointEstx = c( 1, 2 )#
, PointEsty = c( 1, 1.5 )#
)
str(linedata)
ggplot(#
linedata#
, aes( x = PointEstx#
, y = PointEsty#
)#
) + geom_line()
ggplot(linedata,aes(x=PointEstx, y=PointEsty) + geom_line())
ggplot(linedata,aes(x=PointEstx, y=PointEsty)) + geom_line()
library(rerddap)
cache_setup(temp_dir = TRUE)
library(rerddap)
cache_info()
get_cache_path()
library(rerddap)#
cache_delete_all()
dat <- tabledap('FED_JSATS_detects', 'study_id="RBDD_2018"', callopts = list(verbose = TRUE))
head(dat)
myURL <- https://coastwatch.pfeg.noaa.gov/erddap/
myURL <- 'https://coastwatch.pfeg.noaa.gov/erddap/'
oscr_info <- rerddap::info('jplOscar', url = myURL)
oscr_info
?rerddap
rerddp::global_search('jplOscar')
rerddap::global_search('jplOscar')
library(sos)
getwd()
devtools::check()
devtools::build()