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

Directions / Assignment Chunks #6

Open
daviddalpiaz opened this issue Feb 6, 2018 · 12 comments
Open

Directions / Assignment Chunks #6

daviddalpiaz opened this issue Feb 6, 2018 · 12 comments

Comments

@daviddalpiaz
Copy link
Contributor

Currently cannot be used for both r and asis engines.

@coatless
Copy link
Collaborator

coatless commented Feb 6, 2018

I think this is wanting to add another flag to processing?

I'm not sure we can easily embed code chunks in directions...

A sample document.

```{asis, directions = TRUE}

Some directions
```{r}
1 + 1  # a line of code
```

```

Another paragraph.

Readability wise, this doesn't work out nicely.

@daviddalpiaz
Copy link
Contributor Author

daviddalpiaz commented Feb 6, 2018

I'm not sure what that example is showing. I don't see the need to have one chunk inside of another.

@coatless
Copy link
Collaborator

coatless commented Feb 6, 2018

The starting issue is a bit sparse. Did you mean something along the lines of:

```{asis, directions = TRUE}
Text
```

```{r, directions = TRUE}
# code
```

going to:

Text

# code

e.g. there is no discrimination between tag placement?

@daviddalpiaz
Copy link
Contributor Author

Written in lab00-main.Rmd:

```{asis, assign = TRUE}
Text
```

```{r, assign = TRUE}
# your code here
```

Becomes in lab00-assign.Rmd:

Text

```{r}
# your code here
```

@coatless
Copy link
Collaborator

coatless commented Feb 7, 2018

So, we can use this to determine the asis chunk:

asis.*?,.*?directions[[:space:]]?=[[:space:]]?[tT]?[rR]?[uU]?[eE]?

And we can force remove in the r chunk with:

,?[[:space:]]?directions[[:space:]]?=[[:space:]]?[tT]?[rR]?[uU]?[eE]?

@inmybrain
Copy link

As of now, can I include R code only in *-assign.Rmd but not in *-sol.Rmd?

@coatless
Copy link
Collaborator

coatless commented Dec 2, 2020

As of now, can I include R code only in *-assign.Rmd but not in *-sol.Rmd?

If a code chunk is marked by:

  • solution = TRUE, only display in *-sol.Rmd.
  • directions = TRUE: only display in *-assign.Rmd
  • Neither solution = TRUE or directions = TRUE: display in both *-sol.Rmd and *-assign.Rmd

These two keywords are hard-wired at the moment:

https://github.com/r-assist/assignr/blob/4b1c75717fc6141ab8490db77ca7b116907301a4/R/assignr.R#L256-L266

@inmybrain
Copy link

@coatless Thanks, but sorry I don't get it here.

What I want to do is

```{r, directions = TRUE}
1+1
```

which only returns the plain text "1+1".

I want it to generate R code only in *-assign.Rmd. Is this currently supported?

@coatless
Copy link
Collaborator

coatless commented Dec 2, 2020

@inmybrain unfortunately, no. The directions= option is only supported under asis.

@inmybrain
Copy link

@coatless Thanks for the clarification. Is there any possibility to include such an option?

@coatless
Copy link
Collaborator

coatless commented Dec 2, 2020

@inmybrain not until the weekend. My mind is on a paper deadline.

@inmybrain
Copy link

@coatless Oh I didn't mean to rush you at all. Please take your time and consider including the option when you have time. Wish you finish your paper by the due date.

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

3 participants