Converting from RStudio to word

Discussion in 'CS1' started by Sam_actuary_123, Sep 6, 2021.

  1. I'm a bit confused about how best to format my exam answers.
    Would copying straight from the terminal be okay (for 2021 Paper B Q1 would look like below):
    For plots are we supposed to post as pictures?
    This is the guidance from the exam instructions:
    "Candidates MUST include the R code used to obtain their answers, together with the main R output produced, in the Word document."



    time = c(1,2,3,4,5,6,7,8,9,10)

    > caffeine = c(52.2,39.3,28.3,19.03,13.96,11.46,8.78,6.55,5.43,5.03)

    >

    > #i)

    >

    > plot(time,caffeine)

    > [​IMG]

    > #ii)

    > # time elapsed increases then caffeine in blod decreaces

    > # seems to be a non-linear negative relationship

    > # as the curve flattens off as time increases
     
  2. John Lee

    John Lee ActEd Tutor Staff Member

    Yes - it's a good plan to get everything right in your script window - then execute it all then copy and paste all the console window into Word, together with your graphs.

    I did a video here on YouTube if it helps.
     
    Sam_actuary_123 likes this.
  3. Very helpful, thanks!
     
    John Lee likes this.
  4. John Lee

    John Lee ActEd Tutor Staff Member

    Glad I could help.
     
  5. Do you know if there's a way to stop the output truncating in the console?

    For example, for the following code:
    # based on 80% conf interval would conclude that the mean portion is less than 2g
    # since p < 5% we reject null hypoth conclude that mean is not equal to 2


    Produces this in the console:
    > # ii)
    > # based on 80% conf interval would conclude that the mean portion is less than 2g
    > # since p < .... [TRUNCATED]

    So copying into word I'd get truncated which is obviously not ideal! Not sure if it's a length thing since the truncated part is actually less characters.


    Thanks
     
  6. John Lee

    John Lee ActEd Tutor Staff Member

    I've seen truncating the width of lines (and so just by writing shorter comments fixes it) but this appears to be truncating of the length of the output.

    My colleague Andrew Martin has offered the following suggestions:

    RStudio version

    This could be a version issue. We don’t think we’ve had anyone with this problem in the later versions of RStudio.
    So first check whether your version of R and RStudio are the recommended IFoA versions.


    RStudio Options

    There are options for limiting console output but my RStudio seems to ignore them! See for example here for older versions:

    https://stackoverflow.com/questions...inted-to-console-getting-truncated-in-rstudio


    In my version I have an option in:

    Tools -> global options -> console -> ‘Limit output line length’

    However, RSTudio seems to ignore this whether or not I have ‘Limit visible console output (requires restart)’ selected.

    Print options

    There is the max.print option:

    getOption("max.print")

    mine appears to default to 1000

    It cuts the console output after 1000 entries

    could change:

    options(max.print=100000)

    or change back:

    options(max.print=1000)

    However, I don’t think that will fix it. From students that I’ve had with this before, it seems to just be the comments that are truncated and not other output?
     

Share This Page