I am currently trying to fill empty data. Other data with frames values First of all I have a blank data with a similar data in the frame. Intialise the frame and then I use a for-loop to fill this data with the values of frames, which are included in another data.frame to speed up the process using an application-type-function What is a method?
Thank you in advance, BenR
Update 2: Fixed example
set.seed (8760) k & lt ; -c (Representative (1: 4, each = 6)) i & lt; - Paste (Representative (Letter ([1: 6], Time = 4)) Value & Lt; - Sample (1: 10000, 24) Input & lt; - Data.frame (k, i, value) u_n & lt; - Unique (Input $ i) id & lt; - Unique (Input $ k) # 'DoConversion #' # 'Changes to a dataset for a more editable version than the original GDX version. #' # '@PRAM X Data Frame Which includes the results of Reporting GMS (Parallel-Construction_Ermimeter). # 'EU-Aggregation Generation #' @ Author BenR DKY Convergence and Lie Function (X) {Stopfonot (class (x)% c% "(data.frame", "matrix") and name with name) == ("Kashmir", "I", "value" )) # Get the technology name and the temporary ID u_n & lt; - Unique (x $ i) id & lt; - Unique (x $ k) # initialize data.frame with all zeros and correct names nodata & lt; - data.frame (setNames (repeat (length (u_n), numeric (length), simple = f), u_n) data & lt; Assign values to specific entries of frames (i X [Joe (x $ i == i & amp; x $ k == j),]) == 0)) {help doConversion (input) # id ABC DEF # 1:
Library (reshape2) dcast (input, k ~ i) # k ABCDEF # 1, 6947 6344 6291 2182 5430 9555 # 2 2 2758 4375 7649 3096 8325 1109 # 3 3 6073 168 2265 8739 6293 9003 # 4 4 6278 1994 8597 332 2716 6504
However, as I said in the comment, the longer format of your input is generally better for data processing in R is.
Comments
Post a Comment