coatless-rpkg / assignr

Tools for Educators Writing Assignments in RMarkdown

Home Page:https://r-pkg.thecoatlessprofessor.com/assignr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Directions / Assignment Chunks

daviddalpiaz opened this issue · comments

Currently cannot be used for both r and asis engines.

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.

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

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?

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
```

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]?

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

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

@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?

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

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

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

@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.