style=p.style,
incl.data=TRUE,
center=c(26,-90),
zoom=6,
controls="all")
Anthiaswoodsi.map
AnthiaswoodsiJSON
Anthiaswoodsi.poly.agg
AnthiaswoodsiJSON <- toGeoJSON(data=round(Anthiaswoodsi.poly.agg,2),
dest="H:/GIS/PROJECTS/Posters/CreaturesOfTheDeep/Ranges/json/")#
Anthiaswoodsi.map
Anthiaswoodsi.map <- leaflet(data=AnthiaswoodsiJSON,
title="Anthiaswoodsi",
base.map=list("ESRIaerial"),
dest="H:/GIS/PROJECTS/Posters/CreaturesOfTheDeep/Ranges/html/",
popup="Occurrence",
style=p.style,
incl.data=TRUE,
center=c(26,-90),
zoom=6,
controls="all")
Anthiaswoodsi.map
19631/477698
diaper<- function(){
input = as.numeric(readline('How many kids: '))
x <- 6500 * input
cost <- x * 0.29
tax <- cost*1.07
wipes <- (x * .02) * 2
creme <- (x * .03)
out <- tax + wipes + creme
out2 <- paste("$", round(out,0), sep="")
return(out2)
}
diaper()
diaper<- function(){
kids = as.numeric(readline("Determine how many kids you will have and press 'Enter'"))
x <- 6500 * kids
cost <- x * 0.29
tax <- cost*1.07
wipes <- (x * .02) * 2
creme <- (x * .03)
out <- tax + wipes + creme
out2 <- paste("$", round(out,0), sep="")
return(out2)
}
diaper()
diaper<- function(){
kids = as.numeric(readline("Determine how many kids you will have and press 'Enter': "))
x <- 6500 * kids
cost <- x * 0.29
tax <- cost*1.07
wipes <- (x * .02) * 2
creme <- (x * .03)
out <- tax + wipes + creme
out2 <- paste("$", round(out,0), sep="")
return(out2)
}
diaper()
kids=2
x <- 6500 * kids
cost = x * 0.29
wipes = (x * 0.02) * 3
cream = x * .03
tax = (cost + wipes + cream) * 1.07
out = tax + wipes + cream
waste = (out * 0.10) + out
waste
sys.time()
now = system.time()
now
now = Sys.time()
now
now = format(Sys.time(), "%M %D %Y")
now
now = Sys.Date()
now
?Sys.Date
now= format(Sys.Date(), "%Y")
now
now= format(Sys.Date(), "%m/%d/%Y")
now
if(waste > 0){
print("yes")
}
txt <- paste("Based on current Amazon.com prices as of ", now)
txt
txt <- paste("Based on current Amazon.com prices as of", now)
txt
waste
final.cost <- round(waste,2)
final.cost
txt <- paste("Based on current Amazon.com prices as of", now, ", your diaper changing costs will total $",final.cost)
txt
txt <- paste("Based on current Amazon.com prices as of", now, ", your diaper changing costs will total $",final.cost, sep="")
txt
txt <- paste("Based on current Amazon.com prices as of ", now, ", your diaper changing costs will total $",final.cost, sep="")
print(txt)
if(final.cost > 0){
txt <- paste("Based on current Amazon.com prices as of ", now, ", your diaper changing costs will total $",final.cost, sep="")
print(txt)
}
final.cost=0
if(final.cost > 0){
txt <- paste("Based on current Amazon.com prices as of ", now, ", your diaper changing costs will total $",final.cost, sep="")
print(txt)
} else
print("no")
diaper<- function(){
kids = as.numeric(readline("Determine how many kids you will have and press 'Enter': "))
x <- 6500 * kids
cost = x * 0.29
wipes = (x * 0.02) * 3
cream = x * .03
tax = (cost + wipes + cream) * 1.07
out = tax + wipes + cream
waste = (out * 0.10) + out
final.cost <- round(waste,2)
now = format(Sys.Date(), "%m/%d/%Y")
if(final.cost > 0){
txt <- paste("Based on current Amazon.com prices as of ", now, ", your diaper changing costs will total $",final.cost, sep="")
print(txt)
} else
print("Proceed to boat dealer and enjoy your freedom!")
}
diaper()
cat("a b c -> \"", letters[1:3], "\"\n")
i <- 4;
data[[sprintf("hello.%1.2d",i)]] <- ...;
now = format(Sys.Date(), "%m/%d/%Y")
now
class(now)
print(sprintf("Based on current Amazon.com prices as of %s", now))
class(final.cost)
print(sprintf("Based on current Amazon.com prices as of %s, your diaper changing costs will total $%f", now, final.cost))
final.cost
sprintf("%.3f", pi)
print(sprintf("Based on current Amazon.com prices as of %s, your diaper changing costs will total $%.2f", now, final.cost))
diaper2<- function(){
kids = as.numeric(readline("Determine how many kids you will have and press 'Enter': "))
x <- 6500 * kids
cost = x * 0.29
wipes = (x * 0.02) * 3
cream = x * .03
tax = (cost + wipes + cream) * 1.07
out = tax + wipes + cream
waste = (out * 0.10) + out
final.cost <- round(waste,2)
now = format(Sys.Date(), "%m/%d/%Y")
if(final.cost > 0){
txt <- paste("Based on current Amazon.com prices as of ", now, ", your diaper changing costs will total $",final.cost, sep="")
print(txt)
print(sprintf("Based on current Amazon.com prices as of %s, your diaper changing costs will total $%.2f", now, final.cost))
} else
print("Proceed to boat dealer and enjoy your freedom!")
}
diaper2()
diaper2<- function(tax=0.07){
kids = as.numeric(readline("Determine how many kids you will have and press 'Enter': "))
x <- 6500 * kids
cost = x * 0.29
wipes = (x * 0.02) * 3
cream = x * .03
tax = (cost + wipes + cream) * (tax + 1)
out = tax + wipes + cream
waste = (out * 0.10) + out
final.cost <- round(waste,2)
now = format(Sys.Date(), "%m/%d/%Y")
if(final.cost > 0){
#     txt <- paste("Based on current Amazon.com prices as of ", now, ", your diaper changing costs will total $",final.cost, sep="")
#     print(txt)
print(sprintf("Based on current Amazon.com prices as of %s, your diaper changing costs will total $%.2f", now, final.cost))
} else
print("Proceed to boat dealer and enjoy your freedom!")
}
diaper2()
11946-3701
8245-5471
2+2
shiny::runApp('K:/dump/multlayers')
shiny::runApp('K:/dump/multlayers')
shiny::runApp('K:/dump/multlayers')
shiny::runApp('K:/dump/multlayers')
shiny::runApp('K:/dump/multlayers')
shiny::runApp('K:/dump/multlayers')
library(rmdexamples)
x <- runif(100)
ecdf(x)
y =ecdf(x)
y
plot(ecdf(x))
1.66+.052
1.66+.52
2.18*2
92000*.02
92000/26
3538*.7
library(leaflet)
leaflet()
shiny::runApp('X:/Data_John/shiny/coralmapperv011')
library(shinythemes)
install.packages("shinythemes")
library(shinythemes)
library(shiny)
shinyApp(
ui = navbarPage("Cerulean",
theme = shinytheme("cerulean"),
tabPanel("Plot", "Plot tab contents..."),
navbarMenu("More",
tabPanel("Summary", "Summary tab contents..."),
tabPanel("Table", "Table tab contents...")
)
),
server = function(input, output) { }
)
# A more complicated app with the flatly theme
shinyApp(
ui = fluidPage(
theme = shinytheme("flatly"),
titlePanel("Tabsets"),
sidebarLayout(
sidebarPanel(
radioButtons("dist", "Distribution type:",
c("Normal" = "norm",
"Uniform" = "unif",
"Log-normal" = "lnorm",
"Exponential" = "exp")),
br(),
sliderInput("n", "Number of observations:",
value = 500, min = 1, max = 1000)
),
mainPanel(
tabsetPanel(type = "tabs",
tabPanel("Plot", plotOutput("plot")),
tabPanel("Summary", verbatimTextOutput("summary")),
tabPanel("Table", tableOutput("table"))
)
)
)
),
server = function(input, output) {
data <- reactive({
dist <- switch(input$dist,
norm = rnorm,
unif = runif,
lnorm = rlnorm,
exp = rexp,
rnorm)
dist(input$n)
})
output$plot <- renderPlot({
dist <- input$dist
n <- input$n
hist(data(), main=paste('r', dist, '(', n, ')', sep=''))
})
output$summary <- renderPrint({
summary(data())
})
output$table <- renderTable({
data.frame(x=data())
})
}
)
library(leaflet)
shiny::runApp('C:/Users/johnf.GMFMC/Dropbox/shiny14')
install.packages("ShinyDash")
shiny::runApp('X:/Data_John/shiny/examples/iframe')
shiny::runApp('X:/Data_John/shiny/examples/iframe')
shiny::runApp('X:/Data_John/shiny/examples/iframe')
shiny::runApp('X:/Data_John/shiny/examples/iframe')
library(shiny)
members <- data.frame(name=c("Name 1", "Name 2"), nr=c('BCRA1','FITM2'))
ui <- fluidPage(titlePanel("Getting Iframe"),
sidebarLayout(
sidebarPanel(
fluidRow(
column(6, selectInput("Member", label=h5("Choose a option"),choices=c('BCRA1','FITM2'))
))),
mainPanel(fluidRow(
htmlOutput("frame")
)
)
))
server <- function(input, output) {
observe({
query <- members[which(members$nr==input$Member),2]
test <<- paste0("http://news.scibite.com/scibites/news.html?q=GENE$",query)
})
output$frame <- renderUI({
input$Member
my_test <- tags$iframe(src=test, height=600, width=535)
print(my_test)
my_test
})
}
shinyApp(ui, server)
shiny::runApp('X:/Data_John/shiny/examples/iframe')
shiny::runApp('X:/Data_John/shiny/examples/iframe')
shiny::runApp('X:/Data_John/shiny/examples/iframe')
shiny::runApp('X:/Data_John/shiny/examples/iframe')
shiny::runApp('X:/Data_John/shiny/examples/iframe')
datum <- 6.92
year <- 2015
themodel <- lm(data ~ year)
themodel <- lm(datum ~ year)
summary(themodel)
predict(themodel, 2016)
?predict.lm
lm.predict
predict(themodel)
setwd("C:/coralmapperv022")
library(leaflet)
leaflet()
leaflet() %>%
addTiles('http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
options = providerTileOptions(noWrap = TRUE))
NewCom <- "gag"
NewCom
print(NewCom)
2+2
x=1000000*60*24*365
y=30000000
x/y
1000000*10
x=1000000*60*24*365
y=30000000
x/y
17520*3
load("X:/Data_John/manuscipts/DFA/SeineTop28.RData")
DF <- SeineTop28[, c(8,10,11, 14:18,i)]
## Nov 16, 2015: Keep all months, do next section in a loop
DF2 <- gbm.prep(DATA=DF,GBM.Y=9);head(DF2)
#DF2 <- subset(DF2, DF2$area == "4"  | DF2$area == "5")
DF2$area <- factor(DF2$area)
library(seascaper)
DF2 <- gbm.prep(DATA=DF,GBM.Y=9);head(DF2)
#DF2 <- subset(DF2, DF2$area == "4"  | DF2$area == "5")
DF2$area <- factor(DF2$area)
DF2 <- gbm.prep(DATA=DF,GBM.Y=9);head(DF2)
load("X:/Data_John/manuscipts/DFA/SeineTop28.RData")
DF <- SeineTop28[, c(8,10,11, 14:18,i)]
i=19
DF <- SeineTop28[, c(8,10,11, 14:18,i)]
DF2 <- gbm.prep(DATA=DF,GBM.Y=9);head(DF2)
DF2$area <- factor(DF2$area)
library(dismo)
source("http://dl.dropbox.com/s/7g0rug82bqpp0b1/brt.functions.R")
DFx <- DF2[1:5000,]
Delta.bin <-gbm.step(data=DFx,
gbm.x=c(1:8),
gbm.y=11,
family = "bernoulli",
tree.complexity=5,
learning.rate=0.01,
bag.fraction=0.5)
Delta.bin <-gbm.step(data=DFx,
gbm.x=c(1:8),
gbm.y=11,
family = "bernoulli",
tree.complexity=5,
learning.rate=0.01,
bag.fraction=0.5,
n.cores=4)
warnings
warnings()
cores<-detectCores(all.tests = FALSE, logical = FALSE)
cores
Delta.bin <-gbm.step(data=DFx,
gbm.x=c(1:8),
gbm.y=11,
family = "bernoulli",
tree.complexity=5,
learning.rate=0.01,
bag.fraction=0.5,
n.cores=cores)
Delta.bin <-gbm.step(data=DFx,
gbm.x=c(1:8),
gbm.y=11,
family = "bernoulli",
tree.complexity=5,
learning.rate=0.01,
bag.fraction=0.5)
library(leaflet)
m <- leaflet() %>%
addTiles() %>%  # Add default OpenStreetMap map tiles
addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R")
m  # Print the map
m <- leaflet() %>%
addTiles() %>%  # Add default OpenStreetMap map tiles
addMarkers(lng=-85, lat=30, popup="Gulf of Mexico")
m  # Print the map
m <- leaflet() %>%
addTiles() %>%  # Add default OpenStreetMap map tiles
addMarkers(lng=-88, lat=27, popup="Gulf of Mexico")
m  # Print the map
m <- leaflet() %>%
addTiles() %>%  # Add default OpenStreetMap map tiles
addMarkers(lng=-88, lat=27, popup="25° 09’")
m  #
m
m <- leaflet() %>%
addTiles() %>%  # Add default OpenStreetMap map tiles
addMarkers(lng=-88, lat=27, popup="x")
m  # Print the map
install.packages("gtrends")
install.packages("gtrendsR")
gconnect("john.froeschke@gmail.com", "jtf^1116")
library(gtrendsR)
gconnect("john.froeschke@gmail.com", "jtf^1116")
res <- gtrends(c("climate change"))
res <- gtrends(c("climate"))
res <- gtrends(c("clinton"))
res <- gtrends(c("nhl", "nba", "nfl"))
library(htmlwidgets)
saveWidget(m, file="C:/dump2/m.html")
library(leaflet)
m <- leaflet() %>%
addTiles() %>%  # Add default OpenStreetMap map tiles
addMarkers(lng=-88, lat=27, popup="x")
m  # Print the map
library(htmlwidgets)
saveWidget(m, file="C:/dump2/m.html")
saveWidget(m, file="K:/dump2/m.html")
##version 0.1
library(rvest)
#### For-hire pelagic
FHP <- read_html("http://sero.nmfs.noaa.gov/operations_management_information_services/constituency_services_branch/freedom_of_information_act/common_foia/CHG.htm")
FHP2 <- FHP %>%
html_table(header=TRUE, fill=TRUE)
FHP3 <- data.frame(FHP2)
FHP4 <- FHP3[5:nrow(FHP3),]
rownames(FHP4) <- NULL
colnames(FHP4) <- FHP4[1,]
FHP5 <- FHP4[2:nrow(FHP4),]
rownames(FHP5) <- NULL
rm(FHP,FHP2,FHP3,FHP4)
#### End: For-hire pelagic
#### Historical Captain  Pelagic permit holders -
HCP <- read_html("http://sero.nmfs.noaa.gov/operations_management_information_services/constituency_services_branch/freedom_of_information_act/common_foia/HCHG.htm")
HCP2 <- HCP %>%
html_table(header=TRUE, fill=TRUE)
HCP3 <- data.frame(HCP2)
HCP4 <- HCP3[5:nrow(HCP3),]
rownames(HCP4) <- NULL
colnames(HCP4) <- HCP4[1,]
HCP5 <- HCP4[2:nrow(HCP4),]
rownames(HCP5) <- NULL
rm(HCP,HCP2,HCP3,HCP4)
#### Historical Captain  Pelagic permit holders -
##For-Hire Reef fish permit holders-
FRF <- read_html("http://sero.nmfs.noaa.gov/operations_management_information_services/constituency_services_branch/freedom_of_information_act/common_foia/RCG.htm")
FRF2 <- FRF %>%
html_table(header=TRUE, fill=TRUE)
FRF3 <- data.frame(FRF2)
FRF4 <- FRF3[5:nrow(FRF3),]
rownames(FRF4) <- NULL
colnames(FRF4) <- FRF4[1,]
FRF5 <- FRF4[2:nrow(FRF4),]
rownames(FRF5) <- NULL
rm(FRF,FRF2,FRF3,FRF4)
#### For-Hire Reef fish permit holders-
##Historical Captain reef fish permit holders-
HRF <- read_html("http://sero.nmfs.noaa.gov/operations_management_information_services/constituency_services_branch/freedom_of_information_act/common_foia/HRCG.htm")
HRF2 <- HRF %>%
html_table(header=TRUE, fill=TRUE)
HRF3 <- data.frame(HRF2)
HRF4 <- HRF3[5:nrow(HRF3),]
rownames(HRF4) <- NULL
colnames(HRF4) <- HRF4[1,]
HRF5 <- HRF4[2:nrow(HRF4),]
rownames(HRF5) <- NULL
rm(HRF,HRF2,HRF3,HRF4)
#### Historical Captain reef fish permit holders-
View(FHP5)
View(FHP5)
AllPermits <- rbind(FHP5,FRF5,HCP5,HRF5)
AllPermits$UID <- 1:nrow(AllPermits)
AllPermitsAddress <- paste(AllPermits$'Mail Recipient',
AllPermits$Address,
AllPermits$City,
AllPermits$State,
AllPermits$Zipcode, sep="-")
AllPermitsString <- data.frame(UID=1:nrow(AllPermits), AddressString=AllPermitsAddress)
View(AllPermitsString)
View(AllPermitsString)
AllPermitsString$FindDups <- duplicated(AllPermitsString$AddressString)
AllPermitsOut <- cbind(AllPermits, AllPermitsString)
library(rgdal)
library(leaflet)
setwd("X:/Data_John/shiny/reeffishmanagementareas/reef_stressed")
polyReefStressed <- suppressMessages(readOGR("reef_stressed_po.shp", layer="reef_stressed_po", verbose=TRUE))
ifelse(x==2, 1,0)
x = 2
ifelse(x==2, 1,0)
ifelse(x==3, 1,0)
ifelse(x==c(2,3), 1,0)
x = c(2,3)
y=2
ifelse(y==x, 1,0)
sum(ifelse(y==x, 1,0))
ifelse(sum(ifelse(y==x, 1,0))>=1, "yes", "no")
x = c(4,5)
y=2
ifelse(sum(ifelse(y==x, 1,0))>=1, "yes", "no")
ifelse(sum(ifelse(y==(c(2,3), 1,0))>=1, "yes", "no")
ifelse(sum(ifelse(y==(c(2,3)), 1,0))>=1, "yes", "no")
y=3
ifelse(sum(ifelse(y==x, 1,0))>=1, "yes", "no")
ifelse(sum(ifelse(y==(c(2,3)), 1,0))>=1, "yes", "no")
y=4
ifelse(sum(ifelse(y==x, 1,0))>=1, "yes", "no")
ifelse(sum(ifelse(y==(c(2,3)), 1,0))>=1, "yes", "no")
