R: dcast error when using subset - differing row sizes -


When using doccache with subset debug, I get the following error about the original error when I get the root error & ; The subset does not match the dealer rows on the data frame.

Data. Error in Frame (..., check.names = FALSE): Logic shows the number of separate rows: 2, 3

I get the error of mtcars dataset With republished. Below is the code with reproduction.

  Library (Rhesipe 2) #DataFrameMTCs 2 & lt; - MTCAR [, C ('vs', 'M', 'Gear', 'Carb')] MTC 2 $ car & lt; - Row name (MTCAR) line.Name (MTCARS2) & amp; Lt; - NULL MTRR 2 $ DualVariable & lt; - 1 Meter's 2 Mlt; - Melt (MCTR2, id = C ('car', 'vs', 'm', 'gear', 'carb') colnames (mtcars2.melt) # [1] "car" "vs" "am" # Girdet "" carb "variable" "value" dcast (mtcars2.melt, vs ~ am, drop = false), margin = tru) # Collection is unavailable: default for # vs. 0 1 (all) # 1 0 12 6 18 # 2 1 7 7 14 # 3 (all) 1913 32 Cadillac & lt; - Subset (MTs 2. ('Cadillac', Cars) & gt; Dakat (Cadillac, vs ~ M, drop = False, margin = tru) # data. Error in frames (..., check .name = FALSE): # logic different punk Number of points: 2, 3 DAX (Cadillac, vs ~ M, margin = True) # vs. 0 (all) # 1 0 1 1 # 2 (all) 1 1   

Last dock It shows that error can be saved by leaving Drop = False status, but the output I want

  vs 0 1 (all) 1 0 1 0 1 2 1 0 0 0 3 (all ) 1 0 1   

Any help would be great! :)

Thanks

Interesting problem! I tried to do it in the past and could not solve it. In fact, I was trying to use Dakabe to export a series of data frames (CSV), no matter how they could subscribe, they would have the same dimensions. This will allow me to 'join' together in Excel or PowerPoint.

Trying a new Dustress gives me an error even after running the code above. & gt; Error in data.frame (..., check.names = FALSE): The logic shows the number of separate rows: 2, 3 and my sessions & gt; SessionInfo () R Version 2.12.2 (2011-02-25) Platform: x86_64-apple-darwin9.8.0 / x86_64 (64-bit) Locale: [1] C Enclosed Base Package: [1] Stats Graphics GDiwilles UTS Dataset Methods Base other attached packages: [1] plyr_1.4 reshape2_1.1 loaded through the namespace (and not attached): [1] stringr_0.4 tools_2.12.2 ----

The error occurs when using DROP = F and MARGINS = T. And the specific reason for the problem is seen when adding some print statement inside the bell (inside the ridge $ label [[1]], the data dock shows what is happening:

  Print ("Printing Data") Print (Data) Print ("Printing Rid $ Label [[1]]") Print (Res $ labels [[1]] Print ("Trying cbind (res $ labels [[1] ]], "[1]" Printing Data "0 (all) NA 1 1 NA 1 2 NA NA NA 3 1 NA 1 [1]" Printing Ries $ Label [[1]] "vs 1 0 2 (All ) [1] "Trying cbind (res $ labels [[1]], data" Error in data.frame (.., Check.names = FALSE): Logic shows the number of separate rows: 2, 3    

Comments