1

This has been happening recently, and I cannot understand how to resolve. N.B. I am using rStudio v0.99.893

I have created a character vector from a data.table, which I then attempt to View, and receive the above error: Error in View : 'names' attribute [4] must be the same length as the vector [1]

The original DT has ~10,000 observations of 12 variables, here is a subset capturing all classes:

> head(DT, 3)
    HQ       URL      type  ID1 ID2  completion  date_first
1: imag image-welcome basic 444 24   0.1111111   2016-01-04 14:55:57 
2: imag image-welcome basic 329 12   0.2222222   2016-03-15 11:37:21
3: imag image-confirm int   101 99   0.1111111   2016-01-06 20:55:07

as.character(sapply(DT, class))
[1] "character"     "character"    "character"    "integer"    
[5] "integer"    "numeric"    "c(\"POSIXct\", \"POSIXt\")"

From DT I create a character vector of the unique values of URL for a subset of interest (only 'imag' HQ):

URL.unique <- unique(DT[HQ == "imag", URL])
> class(URL.unique)
[1] "character"

> names(URL.unique)
NULL

> View(URL.unique)
Error in View : 'names' attribute [4] must be the same length as the vector [1]

> length(URL.unique)
[1] 262

Printing URL.unique in the console works fine, as does exporting it via write.table() but it is annoying that I cannot view it.

Unless there is something implicitly incorrect about the above, I am resorting to reinstalling rStudio. I've already tried quitting and relaunching, just in case there was some issue as I tend to leave multiple projects open on my computer over days.

Any help would be appreciated!

daRknight
  • 253
  • 3
  • 17
  • 2
    This sounds like something you should take up with Issue tracker on RStudio github page. – Roman Luštrik May 04 '16 at 15:56
  • 1
    I doubt reinstalling will help; looks like a design decision/flaw they've made. You can probably `View(data.frame(u = URL.unique))` though. – Frank May 04 '16 at 16:13
  • You can also use `utils::View` as suggested by @gung's answer here http://stackoverflow.com/a/19346803 – Frank May 04 '16 at 16:21
  • @Frank -- thanks for that, `View(data.frame(u = URL.unique))` is a sufficient workaround for the time being -- I tried `utils:View` and got an `xcrun: error: invalid active developer path...` I'll read more on the original post but you have given me a sufficient solution thus far -- shall I mark this as the 'answer'? – daRknight May 04 '16 at 16:34
  • Hi from RStudio, we've filed an issue to investigate this (will keep you posted if we resolve it). – Jonathan May 04 '16 at 18:30
  • @Jonathan -- Appreciated, I resort to stackoverflow as my first response due to its efficiencies, good to know my 'rstudio' tag will attract the right eyes though.. :) – daRknight May 04 '16 at 22:06
  • Hello again from RStudio! We think we have a fix for this in the dailies -- try build 1.1.2 or higher and let us know how it works out. https://dailies.rstudio.com/ – Jonathan Nov 18 '16 at 00:14
  • If I'm understanding everything correctly, I'm seeing this in Docker `REPOSITORY: rocker/rstudio, TAG: latest, IMAGE ID: 403eaed10ba8` . Any sense of when the fix will be visible in the Docker image? – blong Nov 19 '16 at 00:27

2 Answers2

1

As noted by @Jonathan, this is currently filed with RStudio to investigate. Can confirm reinstalling and other measures did not resolve the issue which still persists. If it is reproduced and filed as a bug, I would request @Jonathan to supply the details here for anyone else to tie into.

The workaround of View(data.frame(u = URL.unique)) does the job to launch the viewer on the data object of interest (thanks @Frank)

daRknight
  • 253
  • 3
  • 17
1

I am using View(as.matrix(df$col_name)) and it seems to be working well.

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109
TheEagle
  • 11
  • 1