Given two data frames: df1 = data.frame(CustomerId = c(1:6), Product = c(rep("Toaster", 3), rep("Radio", 3))) df2 = data.frame(CustomerId = c(2, 4, 6), State = c(rep("Alabama", 2), rep("Ohio", 1))) df1 # CustomerId Product # 1 Toaster # 2 Toaster # 3 Toaster # 4 Radio # 5 Radio # 6 Radio df2 # CustomerId State # 2 Alabama # 4 Alabama # 6 Ohio How can I do database style, i.e., sql style, joins? Th
If your question is "how can I determine how many clusters are appropriate for a kmeans analysis of my data?", then here are some options. The wikipedia article on determining numbers of clusters has a good review of some of these methods. First, some reproducible data (the data in the Q are... unclear to me): n = 100 g = 6 set.seed(g) d <- data.frame(x = unlist(lapply(1:g, function(i) rnorm(n/g,
I have a file, someFile, like this: $cat someFile hdisk1 active hdisk2 active I use this shell script to check: $cat a.sh #!/usr/bin/ksh for d in 1 2 do grep -q "hdisk$d" someFile && echo "$d : ok" done I am trying to convert it to Perl: $cat b.sh #!/usr/bin/ksh export d for d in 1 2 do cat someFile | perl -lane 'BEGIN{$d=$ENV{'d'};} print "$d: OK" if /hdisk$d\s+/' done I export the variable d in
I want to make a heatmap in ggplot2. My toy data and code is: set.seed(12345) dat <- data.frame( Row = rep(x = LETTERS[1:5], times = 10) , Col = rep(x = LETTERS[1:10], each = 5) , Y = rnorm(n = 50, mean = 0, sd = 1) ) library(ggplot2) p <- ggplot(data = dat, aes(x = Row, y = Col)) + geom_tile(aes(fill = Y), colour = "white") + scale_fill_gradient(low = "white", high = "steelblue") p I want to have
Suppose I have a ggplot with more than one legend. mov <- subset(movies, length != "") (p0 <- ggplot(mov, aes(year, rating, colour = length, shape = mpaa)) + geom_point() ) I can turn off the display of all the legends like this: (p1 <- p0 + theme(legend.position = "none")) Passing show_guide = FALSE to geom_point (as per this question) turns off the shape legend. (p2 <- ggplot(mov, aes(year, rati
How to wait in a bash script for several subprocesses spawned from that script to finish, and then return exit code !=0 when any of the subprocesses ends with code !=0? Simple script: #!/bin/bash for i in `seq 0 9`; do calculations $i & done wait The above script will wait for all 10 spawned subprocesses, but it will always give the exit status 0 (see help wait). How can I modify this script so it
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く