Re: [R] Simple Binning of Values

2012-06-12 Thread Martin Striz
Hi, I just joined the list, but here's a suggestion. x - c(123, 48, 342, 442, 43, 232, 32, 129, 191, 147) bins - as.data.frame(table(cut(x, breaks=c(0, 100, 200, 300, 400, 500), labels=c(0-100, 100-200, 200-300, 300-400, 400-500 colnames(bins) - c(bins, count) bins bins count 1

[R] extracting columns with same partial name

2010-01-14 Thread Martin Striz
Hi folks, I'm new to the list. I have a data file with 256 columns. Here's just a subset of names(data): [1] MOUSE BASEDATE1 PERCENTSLEEPTOT1 [4] PERCENTSLEEPNIGHT1 PERCENTSLEEPDAY1BOUTLENGTHTOT1 [7] BOUTLENGTHNITE1 BOUTLENGTHDAY1 BOUTTHRESTOTP1 [10]

Re: [R] extracting columns with same partial name

2010-01-14 Thread Martin Striz
On Thu, Jan 14, 2010 at 1:57 PM, Dennis Murphy djmu...@gmail.com wrote: Try this: nms - paste(BOUTLENGTHTOT, 1:17, sep = ) data[, nms] On Thu, Jan 14, 2010 at 2:08 PM, Peter Ehlers ehl...@ucalgary.ca wrote: Try dat[names(dat) %in% paste(BOUTLENGTHTOT, 1:17, sep=)] Thanks! Both