So farewell then…

Whitney Houston
Larry Hagman
Ray Bradbury
William Rees Mogg
Donna Summer
Robin Gibb
Neil Armstrong
Norman Schwarzkopf Jr.(Stormin)
Gerry Anderson
Kenneth Kendall
Sir Patrick Moore 🙁

Nearly all of them at a great age.

Correlation Matrix in R CRAN

Here it should be assumed that you have the values as columns on a spreadsheet and everywhere you don’t have a value you have replaced the gap with the letters NA.

Month A B C D E
Apr 63.91419 21.13823 75.13719 80.97858 11.86916
May 92.51104 126.4206 129.9751 56.79248 36.77565
Jun 65.44783 39.14822 6.558068 19.42456 21.63901
Jul 131.4266 70.55551 63.00389 102.5545 116
Aug 129.3926 31.60157 2.435477 NA 73.03078
Sep 35.71819 6.667624 89.68176 98.86681 26.59825
Oct 53.36333 97.32301 63.80283 2.39816 41.05988
Nov 38.88958 88.80514 118.4024 3.027732 64.32666
Dec NA 123.3156 123.5542 79.57653 62.26653
Jan 6.570292 11.66491 72.28813 31.43667 39.0891
Feb 15.1047 9.964003 144.4861 48.67408 146.2865
Mar 78.85201 10.53091 147.5341 67.90013 40.08176

Copy The Data into the clipboard:

cr<-read.table("clipboard",header=TRUE, na.strings="NA" )
x <-cr[2:5]
 cm<-cor(x,x,use = "pairwise.complete.obs")

Now output the Matrix back to the clipboard

write.table(cm,"clipboard",sep="\t")

and paste it back into Excel &c.

If you get a buffer full error then use :

write.table(cm,"clipboard-2048",sep="\t")

instead

A B C D
A 1 0.3 -0 0.4
B 0.3 1 0.2 -0
C -0 0.2 1 0.2
D 0.4 -0 0.2 1

connecting using jdbc and pulling back some data

Connecting to some sql servers with jdbc.

Download the JDBC driver for your databases and add them to the project in eclipse (or whatever) then:

import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class DbConnect{
public static void main(String args[]){
	String dbtime="";String db_connect_string="";String db_userid="";String db_password="";String query="";
	try {
	//Class.forName("com.mysql.jdbc.Driver");
	Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
	int choose=2;
	switch (choose)
	{
	case 0:
		db_connect_string="jdbc:mysql://yourMySQLServerNameHere/yourMySQLData";
		db_userid="ooooohyourusername";
		db_password="waaaaaayYourPassword";
		query = "Select top 10 * FROM YourTable";
		break;
	case 1:
		db_connect_string="jdbc:sqlserver://yourSQLServerNameHere;databaseName=yourDatabaseName";
		db_userid="ooooohyourusername";
		db_password="waaaaaayYourPassword";
		query = "Select top 10 * FROM YourTable";
		break;		
	}
	Connection con = DriverManager.getConnection(db_connect_string,db_userid, db_password);
	Statement stmt = con.createStatement();
	ResultSet rs = stmt.executeQuery(query);
	int rn=0;
	while (rs.next()) {
	dbtime = rs.getString(1)+"  "+rs.getString(2)+"  "+rs.getString(3)+"  "+rs.getString(4)+"  "+rs.getString(5);
	System.out.println(rn+" : "+dbtime);
	rn++;
	} con.close();	
} //end try
catch(ClassNotFoundException e) {e.printStackTrace();}
catch(SQLException e) {e.printStackTrace();}
}
}