Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstring unable to view the comment #27

Open
kartik1611 opened this issue Sep 25, 2020 · 11 comments
Open

Docstring unable to view the comment #27

kartik1611 opened this issue Sep 25, 2020 · 11 comments

Comments

@kartik1611
Copy link

kartik1611 commented Sep 25, 2020

I am unable to view the comments after changing the below function name and trying to view the comments , snippet and code below for reference purpose

Initially my function name was square but then changed to another variable and then tried to view the comments but I was unable to do so
image

image

### code for reference purpose
`
rm(list=ls(all=T))
library(docstring)
ab <- function(a){
#' @title :square function
#' @description : print the squares of the number
#'from 1 to the input given
#' @param : input number
#' @output : provide the squares of the input range
for(i in 1:a){
b <- i^2
print(b)
}
}
?ab

`

@ghost
Copy link

ghost commented Sep 23, 2021

I could not replicate this issue. Are you still affected by it?

@Dasonk
Copy link
Owner

Dasonk commented Dec 21, 2021

I'm also unable to reproduce this error. If you have any further info let me know but I'm going to close this for the time being.

@Dasonk Dasonk closed this as completed Dec 21, 2021
@KristanRomano
Copy link

I do have the same issue.

@Dasonk
Copy link
Owner

Dasonk commented Apr 15, 2022

Interesting - I still can't reproduce but can you provide the output of sessionInfo() and Sys.info()? That might help with debugging.

@Dasonk Dasonk reopened this Apr 15, 2022
@KristanRomano
Copy link

The above code is working now. But this one does not

library(docstring)
prova<-function(x){
#'@title prova
#'@description blabla
#'@param x blabla
#'@output x-1
x-1
}

@mbuerg
Copy link

mbuerg commented Oct 6, 2023

I had a similar problem. I fixed it by using docstring(my_function) rather than ?my_function. I got an loadNamespace(x) error regarding rstudioapi the first time, but could solve it by

install.packages("rstudioapi")
library(rstudioapi)

@Jiayou-Chao
Copy link

Interesting - I still can't reproduce but can you provide the output of sessionInfo() and Sys.info()? That might help with debugging.

I found that we can't have two functions that both have docstrings. They have the issue most likely because they had another function with docstrings.

library(docstring)
test1 <- function(x) {
  #' This is a test function
  #' @param x a number
  x <- x + 1
  return(x)
}

test2 <- function(x) {
  #' This is a test function
  #' @param x a number
  x <- x + 1
  return(x)
}

?test1
?test2

The output shows test1 is fine but not test2:

> ?test1

> ?test2
No documentation for ‘test2’ in specified packages and libraries:
you could try ‘??test2’

@Jiayou-Chao
Copy link

I had a similar problem. I fixed it by using docstring(my_function) rather than ?my_function. I got an loadNamespace(x) error regarding rstudioapi the first time, but could solve it by

install.packages("rstudioapi") library(rstudioapi)

This is very helpful information. If you run docstring(my_function) once, you will be able to run ?my_function in the future.

@Dasonk
Copy link
Owner

Dasonk commented Nov 3, 2023

Interesting. I'll investigate. Are you using RStudio? Does the problem persist if you use R outside of RStudio?

@Jiayou-Chao
Copy link

Interesting. I'll investigate. Are you using RStudio? Does the problem persist if you use R outside of RStudio?

Yes, I use RStudio. I tried RGUI again, and got the same error.

@Jiayou-Chao
Copy link

It seems there has already been a pull request to fix it.
#29 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants