This file contains 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
DROP TABLE followers; | |
CREATE TABLE followers ( | |
followed_id text, | |
follower_id text, | |
created timestamp, | |
messages_count int, | |
likes_count int, | |
PRIMARY KEY ((followed_id, follower_id)) | |
); |
This file contains 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
# the following will work (followed_id,follower_id is a partition key)# | |
cqlsh:test> select * from followers where followed_id='123' and follower_id='567'; | |
followed_id | follower_id | created | likes_count | messages_count | |
-------------+-------------+--------------------------+-------------+---------------- | |
123 | 567 | 2011-02-03 05:05:00+0100 | 5 | 2 | |
# the following will not work (followed_id,follower_id is a partition key)# |
This file contains 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
DROP TABLE followers; | |
CREATE TABLE followers ( | |
followed_id text, | |
follower_id text, | |
created timestamp, | |
messages_count int, | |
likes_count int, | |
PRIMARY KEY (followed_id, follower_id) | |
); |
This file contains 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
CREATE TABLE table1 ( | |
a1 text, | |
a2 text, | |
b1 text, | |
b2 text, | |
c1 text, | |
c2 text, | |
PRIMARY KEY ( (a1, a2), b1, b2 ) | |
); |
This file contains 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
library("ggplot2") | |
logfile = " | |
task a,2,9 | |
task b,3,8 | |
task c,1,4 | |
task d,5,12 | |
" | |
# read in the sample logfile in a data frame |
This file contains 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
library("ggplot2") | |
#sample logfile | |
logfile = " | |
task a,2013-10-10 11:16:16,2013-10-10 11:21:16 | |
task b,2013-10-10 11:15:16,2013-10-10 11:18:45 | |
task c,2013-10-10 11:20:20,2013-10-10 11:21:00 | |
task d,2013-10-10 11:14:23,2013-10-10 11:19:30 | |
" |
This file contains 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
library("ggplot2") | |
# calculate a 1000 iterations for a selection of four sample from | |
# a normal population N(0,1) | |
mean.statistics= sapply(1:1000, function(x) {sum(rnorm(4,0,1))/4}) | |
#base plot, but no functions | |
p = ggplot(data.frame(mean.statistics), aes(mean.statistics)) + xlim(-2,2) |
This file contains 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
> mean.muhat = mean(mean.statistics) | |
> mean.muhat | |
[1] 0.007315414 | |
> | |
> mean.sehat = sd(mean.statistics) | |
> mean.sehat | |
[1] 0.4974518 | |
> | |
> # mean = 0.007 +- 2*0.5 |
This file contains 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
library("MASS") | |
write.csv(Cars93, 'cars93.csv') |
This file contains 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
library('ggplot2') | |
#basics | |
3*4 | |
2^3 | |
1/2 + 1/2*sqrt(5) | |
#those two are identical | |
(1+2+3+4)/4 |