nachocab / clickme

An R package to create interactive plots
257 stars 44 forks source link

Difficulty running examples #45

Closed benzipperer closed 10 years ago

benzipperer commented 10 years ago

After a new installation of clickme, I can't run either example listed on the readme. Do you have any suggestions on how I should proceed?

First example

clickme(points, rnorm(100))
Error: x has 1 elements, but y has 100

Second example

data(microarray)
clickme(points, x = microarray$significance, y = microarray$logFC,
        color_groups = ifelse(microarray$adj.P.Val < 1e-4, "Significant", "Noise"),
        names = microarray$gene_name,
        x_title = "Significance (-log10)", y_title = "Fold-change (log2)",
        extra = list(Probe = microarray$probe_name))

Error in file(con, "w") : cannot open the connection
In addition: Warning messages:
1: In `$.data.frame`(names_groups, group) :
  Name partially matched in data frame
2: In `$.data.frame`(names_groups, group) :
  Name partially matched in data frame
3: In file(con, "w") :
  cannot open file '/usr/local/lib/R/site-library/clickme/output/temp-Points.html': Permission denied
nachocab commented 10 years ago

Sorry, I changed the code but haven't updated the documentation yet. My bad. Try adding quotes around the word points and let me know. If you get an error run traceback() On Jun 20, 2014 12:12 PM, "benzipperer" notifications@github.com wrote:

After a new installation of clickme, I can't run either example listed on the readme. Do you have any suggestions on how I should proceed?

First example

clickme(points, rnorm(100)) Error: x has 1 elements, but y has 100

Second example

data(microarray) clickme(points, x = microarray$significance, y = microarray$logFC, color_groups = ifelse(microarray$adj.P.Val < 1e-4, "Significant", "Noise"), names = microarray$gene_name, x_title = "Significance (-log10)", y_title = "Fold-change (log2)", extra = list(Probe = microarray$probe_name))

Error in file(con, "w") : cannot open the connection In addition: Warning messages: 1: In $.data.frame(names_groups, group) : Name partially matched in data frame 2: In $.data.frame(names_groups, group) : Name partially matched in data frame 3: In file(con, "w") : cannot open file '/usr/local/lib/R/site-library/clickme/output/temp-Points.html': Permission denied

— Reply to this email directly or view it on GitHub https://github.com/nachocab/clickme/issues/45.

benzipperer commented 10 years ago

Thanks! Here is the new error

> clickme("points", rnorm(100))
Error in file(con, "w") : cannot open the connection
In addition: Warning message:
In file(con, "w") :
  cannot open file
'/usr/local/lib/R/site-library/clickme/output/temp-Points.html

and traceback() says:

> traceback()
6: file(con, "w")
5: writeLines(html_code, internal$file$paths$output_file)
4: .self$generate()
3: points$display() at Points.R#224
2: clickme_helper[[snake_case_template]](...)
1: clickme("points", rnorm(100))

On Fri, Jun 20, 2014 at 12:26 PM, Nacho Caballero notifications@github.com wrote:

Sorry, I changed the code but haven't updated the documentation yet. My bad. Try adding quotes around the word points and let me know. If you get an error run traceback() On Jun 20, 2014 12:12 PM, "benzipperer" notifications@github.com wrote:

After a new installation of clickme, I can't run either example listed on the readme. Do you have any suggestions on how I should proceed?

First example

clickme(points, rnorm(100)) Error: x has 1 elements, but y has 100

Second example

data(microarray) clickme(points, x = microarray$significance, y = microarray$logFC, color_groups = ifelse(microarray$adj.P.Val < 1e-4, "Significant", "Noise"), names = microarray$gene_name, x_title = "Significance (-log10)", y_title = "Fold-change (log2)", extra = list(Probe = microarray$probe_name))

Error in file(con, "w") : cannot open the connection In addition: Warning messages: 1: In $.data.frame(names_groups, group) : Name partially matched in data frame 2: In $.data.frame(names_groups, group) : Name partially matched in data frame 3: In file(con, "w") : cannot open file '/usr/local/lib/R/site-library/clickme/output/temp-Points.html': Permission denied

— Reply to this email directly or view it on GitHub https://github.com/nachocab/clickme/issues/45.

— Reply to this email directly or view it on GitHub https://github.com/nachocab/clickme/issues/45#issuecomment-46698244.

benzipperer commented 10 years ago

Sorry, that copy and paste didn't work. The error is Error in file(con, "w") : cannot open the connection In addition: Warning message: In file(con, "w") : cannot open file '/usr/local/lib/R/site-library/clickme/output/temp-Points.html': Permission denied

nachocab commented 10 years ago

Thanks for pointing this out @benzipperer, it's an interesting bug.

What do you get when you do system.file(package = "clickme")? It seems that the folder /usr/local/lib/R/site-library/ doesn't exist. Did you set the variable clickme_output_path? You can check by running getOption("clickme_output_path"). That folder has to exist, otherwise dir.create returns a warning, for example if you do dir.create("/my_folder"), it returns cannot create dir '/my_folder', reason 'Permission denied'.

I might change clickme so this is an error and not just a warning.

benzipperer commented 10 years ago

Thanks, @nachocab! That was the issue! clickme was defaulting to the output path of /usr/local/lib/R/site-library/clickme/output, which existed, but to which I didn't have write permissions. Running option(clickme_output_path=getwd()) solved the problem.

In the second example, I still get the following warnings, but the scatterplot looks great:

Warning messages:
1: In `$.data.frame`(names_groups, group) :
  Name partially matched in data frame
2: In `$.data.frame`(names_groups, group) :
  Name partially matched in data frame