« first day (250 days earlier)      last day (3561 days later) » 

1:26 AM
Three answers to completely different questions, it seems:
0
Q: Can not understand the output order of levels and data.frame

it_is_a_literatureThere is a data.frame,i print it with aspply. df<-data.frame(name=c("alice","becka","james","jeffery","john"), sex=c("F","M","M","F","M"), age=c(13,13,12,13,12), height=c(56.5,65.3,57.3,62.5,69), weigh...

 
@Frank FWIW I think your answer is spoton
+1
 
2:21 AM
@Frank I've deleted my answer. That SO user needs to learn how to write. I don't care if they think that computer programming is a literature or not. I'm pretty close to ignoring any of their future questions.
 
3:02 AM
yeah, my memory of this user's q's isn't very long, but this is pretty egregious. maybe if they'd just written a new question (or two) as they went along, it wouldn't be so bad
@geektrader Thanks :)
 
 
2 hours later…
5:09 AM
@Frank My memory is of some funny comments from @DWin telling the user to learn how to capitalize and punctuate their posts. :-)
And they are offering even more bounties.... I wonder what the edit on that question will be.
 
 
6 hours later…
11:40 AM
I really think questions like this shouldn't be answered.. how can people find asking question like this on SO to be faster than reading some basic intro manual
-1
Q: mean of three values in the data.frame

Shaxi LiverJust fast and simple question. I want to calculate the mean of 3 valus in the data.frame. > head(df) 1 K 2 5 4 2 2 L 2 1 4 1 3 M 1 3 4 3 4 N 3 2 1 1 5 H 7 8 11 13 I'd like to get the mean of the 7, 8 and 11 which are in the 5 row of this data.frame. Why this code...

 
12:03 PM
another one!!! :-O
0
Q: Working with imported CSV files in R

Chris DobkowskiI just imported a csv file into R, and I see all the data, but how do I actually work with those now?

 
@geektrader arguably... stackoverflow.com/q/19802730/1478381 !! :-)
 
indeed!
that's why i marked my answer community answer..
atleast OP there had put some effort
 
yes that is very true
 
12:18 PM
@SimonO101, geektrader is right that this is currently being discussed.
(reg. your question here):
0
Q: Can data.table handle identical column names when using .SDcols?

SimonO101When using .SD to apply a function to a subset of dt's columns I can't seem to find the correct way to handle the situation where I have duplicated column names... e.g. # Make some data set.seed(123) dt <- data.table( matrix( sample(6,16,repl=T) , 4 ) ) setnames(dt , rep( letters[1:2] , 2 ) ) #...

 
@Arun ok thanks. I think that specifying numeric positions should be expected to work right out the box though no? I can understand column names not working.
I'll get onto the data.table mailing list and catch up
 
I guess mine (and Steve's) views are more towards not having dup-names at all (probably while loading a file or even allowing to create a data.table with data.table(.) function) but maybe not while grouping/aggregating/subsetting etc...
 
got a link for speed?
 
@SimonO101 The problem is that ".SD" is constructed using "xvars" which is column names. In order to do it in a way so that dup cols are not omitted, one has to change column-name subsetting to column-number subsetting.
And I'm not sure if that's good (and if that's really necessary for a feature that's not that much in use).
 
@Arun ok, but the documentation should be updated because really (and don't get me wrong I love data.table), reading .SDcols Specifies the columns of x included in .SD. May be character column names or numeric positions, I as a user, expect it to work properly when I specify c(1,3).
because I'm not aware that data.table is doing any name matching behind the scenes
does that make sense?
@Arun thanks!
 
12:25 PM
@SimonO101 Yes, that'll be done before the next stable version gets released, I suppose. @Ricardo already filed a bug on this. Another issue is that within [, the columns are seen as variables... which also would pose problems when col names are duplicated.
@SimonO101 Yes, it doesn't matter if you provide .SDcols as integer or character, xvars (that is used as a j argument with with=FALSE) used to subset .SD at this point is a character vector.
 
Hmm, yes I do see your problem. I wonder if you could give column names attributes (possibly hidden), one of which could be the integer position of the column in the data.table?
 
@SimonO101 Perhaps. But I still wonder if it would solve the issue of using them as variables...
 
Well, only if a warning was generated, .e.g. warning: duplicate column names specified in j. This affects columns: 1,3. Use .attr to specify which columns you want in j or something along those lines.
Not even sure if its possible, let alone feasible!
Thanks for weighing in though. Appreciated
 
@SimonO101 I was talking about operations like: dt[, list(x_div=x/x[1]), by=list(y)] where it's hard to tell which "x" col should one refer to.
 
user asking same question again
0
Q: Vectorize the populating of a high-D array

user1073999I'm populating distribution testa with observations test_idxs test_idxs <- matrix(sample(c(1,2,3), 300000, repl=T), ncol=3) testa_for_looped <- array(0, c(3,3,3)) testa_vectorized <- array(0, c(3,3,3)) system.time( for (i in 1:nrow(test_idxs)) { testa_for_looped[rbind(test_idxs[i,])] <- testa_fo...

 
12:36 PM
You're right that the documentation needs change to reflect the "scope" of duplicate names (I'd like to keep it as minimal as possible - loading + creating, but nothing else). Thanks again for reporting. I'll add the links to your post.
 
@Arun thanks.
 
 
4 hours later…
EDi
4:53 PM
Uhh, I have a new friend:
Wooo Thnaks EDi, Go and Fly a kite man if you dont right the proper answer, just shut up and go away . you sb — Razor 34 mins ago
 
@EDi I noticed that too. Just voted to close and move on, especially after a comment like that :-)
 
EDi
jupp, just did my first 'flag'...
 
5:29 PM
@EDi the comment has changed now to a lovely formatted R code. :)
 

« first day (250 days earlier)      last day (3561 days later) »