This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @cols AS NVARCHAR(MAX)='' | |
DECLARE @query AS NVARCHAR(MAX)='' | |
SELECT @cols = @cols + QUOTENAME(Crop) + ',' FROM (select distinct [Crop] from [FAF40].[dbo].[county_farm_acres2014] ) as tmp | |
set @query = | |
'SELECT * from | |
( | |
select StateCode, CountyCode, Crop from [FAF40].[dbo].[county_farm_acres2014] | |
) src |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cast([FINAL Freight Cost] as float) | |
cast(ISNULL([FINAL Freight Cost],0) as float) | |
NULLIF(CAST(ISNULL([FINAL Freight Cost],0) as float), 0) | |
convert(float,replace([FINAL Freight Cost],',','') )[FINAL Freight Cost] | |
CAST([FINAL Freight Cost] AS FLOAT) AS CastedValue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select * from GPC_INBOUND | |
where isnumeric([FINAL Freight Cost]) <> 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To enable rJava support, run the following command: | |
R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers | |
If you've installed a version of Java other than the default, you might need to instead use: | |
R CMD javareconf JAVA_CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers -I/Library/Java/JavaVirtualMachines/jdk<version>.jdk/" | |
(where <version> can be found by running `java -version`, `/usr/libexec/java_home`, or `locate jni.h`), or: | |
R CMD javareconf JAVA_CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers -I$(/usr/libexec/java_home | grep -o '.*jdk')" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
as.POSIXlt(as.Date(i)) | |
orders$day <- orders$dd_mmm_yy$mday # day of month | |
orders$month <- orders$dd_mmm_yy$mon+1 # month of year (zero-indexed) | |
orders$year <- orders$dd_mmm_yy$year+1900 # years since 1900 | |
# http://stackoverflow.com/questions/8126537/extract-date-elements-from-posixlt-and-put-into-data-frame-in-r |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original two | |
ggplot(US_Propane_Weekly, aes(as.Date(date), value)) + geom_line() + xlab("date") + ggtitle("US_Propane_Weekly") | |
ggplot(Iowa_Propane_Monthly, aes(as.Date(date), value)) + geom_line() + xlab("date") + ggtitle("Iowa_Propane_Monthly") | |
# Combine into one | |
p = ggplot(US_Propane_Weekly, aes(as.Date(date), value)) + geom_line() + xlab("date") + ggtitle("US_Propane_Weekly vs. Iowa_Propane_Monthly") | |
p = p + geom_line(data = Iowa, aes(as.Date(date), value), colour="red") | |
p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# In[1]: | |
import openpyxl | |
import csv | |
# In[2]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# In[1]: | |
import openpyxl | |
# In[2]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reshape(dat1, idvar = "name", timevar = "numbers", direction = "wide") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import warnings; warnings.filterwarnings("ignore"); |
NewerOlder