similar to: data.table query

Displaying 20 results from an estimated 10000 matches similar to: "data.table query"

2010 Oct 14
5
Replacing N.A values in a data frame
Hello, I have a data frame as below ... in cases where I have N.A. I want to use an average of the past date and next date .. any help? 13/10/2010 A 23 13/10/2010 B 12 13/10/2010 C 124 14/10/2010 A 43 14/10/2010 B 54 14/10/2010 C 65 15/10/2010 A 43 15/10/2010 B N.A. 15/10/2010 C 65 ---------------------------------------------------------------------------- -------------------------- Thanks
2010 Sep 17
7
removing specific rows from array
I'm attempting to create an array of treatment comparisons for modelling data generation. This involves comparison of one treatment (c2) with another (c3), relative to a common comparator (c1). Attached code gives me the correct array but need to remove duplicates. Duplicates relate only to c2 and c3 such that I need to remove r3 because c2 and c3 are same as r1 with c2 and c3 swapped r5
2010 Nov 03
4
Drawing circles on a chart
Dear Group, I have the following data matrix which is a timeseries. > dput(tData) structure(list(A = c(0.2, 0.13, 0.05, 0.1, 0.02, 0.18, 0.09, 0.06, 0.13), B = c(0.15, 0.06, 0.09, 0.02, 0.03, 0.12, 0.01, 0.15, 0.06), C = c(-0.1, 0, -0.07, -0.06, -0.05, -0.05, -0.06, -0.08, -0.07), D = c(-0.15, -0.05, -0.1, -0.03, -0.13, -0.04, -0.1, -0.04, -0.15), E = c(-0.17, -0.16, -0.08, -0.07, -0.09,
2010 Oct 27
5
Best IDE for R
Dear R-Group, I am looking for suggestions for the "best" IDE for R. Best is obviously subjective but I need just the basic features that should function well (and I looked through the threads already). - Proper integration with R 2.11.1 - Good key shortcuts ... similar to the R Gui - Manageability of Projects, etc. - Neat formatting features I tried Revolution R but it seems huge in
2010 Oct 11
3
Dataset Transformation
I need to transpose the following input dataset into an output dataset like below Input Date TICKER Price 11/10/2010 A 0.991642 11/10/2010 B 0.475023 11/10/2010 C 0.218642 11/10/2010 D 0.365135 12/10/2010 A 0.687873 12/10/2010 B 0.47006 12/10/2010 C 0.533542 12/10/2010 D 0.812439 13/10/2010 A 0.210848 13/10/2010 B 0.699799 13/10/2010 C
2010 Dec 03
1
intraday zoo
I'm trying to read intraday zoo but running into issues (again) ... what am I missing here? (the date doesn't seem to read in correctly) > head(dat) TrdDate TrdTime impliedVol 1 20090102 09:55:03 0.3610715 2 20090102 09:55:04 0.3637943 3 20090102 09:55:05 0.3752375 4 20090102 09:55:05 0.4190025 5 20090102 09:55:06 0.3696080 6 20090102 09:55:06 0.4944981 > f <-
2011 Mar 17
3
Flexible rbind
Dear All, I am trying to create a empty structure that I want to fill gradually through the code. I want to use something like rbind to create the basic structure first. I am looking for a possibility to do an rbind where the columns names dont match fully (but the missing columns can be defaulted to either zero or n/a) (my actual data has a lot of columns). Please see the data frames below I
2010 Nov 09
3
Row-wise recurive function call
Dear Group, I have a following dataset: > a A B C D 1 22 3 31 40 2 26 31 36 32 3 3 7 49 16 4 24 40 27 26 5 20 45 47 0 6 34 43 11 18 7 48 48 24 2 8 3 16 39 48 9 20 49 7 21 10 17 36 47 10 > dput(a) structure(list(A = c(22L, 26L, 3L, 24L, 20L, 34L, 48L, 3L, 20L, 17L), B = c(3L, 31L, 7L, 40L, 45L, 43L, 48L, 16L, 49L, 36L), C = c(31L, 36L, 49L, 27L, 47L, 11L, 24L,
2010 Oct 22
2
If Statement with more than one condition
I'm unable to find the OR operator like other language .. any suggestions? I want to do If (condition1 OR condition 2){ do something } Thanks for answering this elementary question. [[alternative HTML version deleted]]
2013 Apr 18
3
Using different function (parameters) with apply
Hi All, I have the following problem (read the commented bit below): a<-matrix(1:9,nrow=3) a [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 div<-1:3 apply(a,2,function(x)x/div) ##want to divide each column by div- instead each row is divided## [,1] [,2] [,3] [1,] 1 4.0 7 [2,] 1 2.5 4 [3,] 1 2.0 3
2010 Dec 03
3
colname refered by a variable
Hello,   I tried to use a variable to refer colname, but I got error, could anyone give me advice?   >df=data.frame(cbind(AB=1:3,AC=3:5)) > df$AC [1] 3 4 5 > df$paste("A","C",sep="") Error: attempt to apply non-function thanks Jian   [[alternative HTML version deleted]]
2010 Dec 05
3
grep for strings
I am trying to find the function where I can search for a pattern in a text string (I thought I could use grep for this but no :(). > x [1] "abcdefghijkl" I want to find the positions (i.e. equivalent of nchar) for "cd" and in case there are multiple hits .. then the results as a array Thank you.
2010 Dec 03
2
Querying a data frame or data.table
Hello Group, Is there an easy way to query a data.frame or data.table (this is fast!) for multiple conditions? I don't want to use a SQL kind of statement. I am looking for something like a subset with multiple conditions. Any tips of the like the binary search methodology used for data.table would also help. Thanks in advance. S
2010 Nov 12
2
Time Delay / Wait
Hi Group, Is there something like a delay function based on System time or equivalent? I basically am generating a few graphs and I would like to see each graph for say 2mins before moving on to the next one? I can always have an empty for-loop I guess but is there a better way? Thanks, S
2010 Dec 07
2
Time out for a R Function
Hello Group, I have an R-function that works fine for most part but sometime runs into a long loop! (I'm lazy and short on time to debug right now so want to do something easy) For my purpose, it is ok to make few errors .... is there a way I can put a timeout on a function and the r-process needes to move on to the next step? Thank you. S
2010 Nov 09
2
Creating a list to store output objects from a recursive loop
Dear Group, I am having a function that I am running in a loop that generated two results for each loop The result1 is a zoo object The result2 is a data frame Now I want to put both of them in a list or some structure ... that I can access or output to a file after the loop is done. For e.g. for (i in 1:20){ niceFunction(x[i],i) } niceFunction (x,i) { result1 = someOperations() #zoo
2011 Apr 18
1
Print out data frames into neat images
Hi Group, I often need to print out data frames with results of analysis into a neat little image to copy and paste into documents. I need apply formatting like bold, currency signs, number formats, header shading etc. I currently output the data into csv and format using good old excel. Any suggestions if there are packages to help with such activities (to some level of basic functionality). I
2010 Nov 12
3
Deploying code as exe
Dear Group, Is there some way for me to package a few lines of R-code as exe and have it running in the background? (unable to find info in the archives) Even better if I can package it as an installation and send to my team who do not have any background in programming / R? If they can install and run the exe ... it would suffice. Thanks, S
2010 Oct 14
2
Drop matching lines from readLines
Dear R-group, I have some noise in my text file (coding issues!) ... I imported a 200 MB text file using readlines Used grep to find the lines with the error? What is the easiest way to drop those lines? I plan to write back the "cleaned" data set to my base file. Thanks.
2010 Nov 01
2
write.csv changes the format of the date
Dear Group, Why does write.csv modify the date format when it write to a file. I have the following variable Param_Dat: dput(Param_Dat) structure(list(Last_Successful_Run = structure(1L, .Label = "30/10/2010", class = "factor")), .Names = "Last_Successful_Run", class = "data.frame", row.names = c(NA, -1L)) When I do: