0

I'm new to R and having some teething issues...

For some reason, and I'm assuming its my data, I can't get it to plot in a line graph using the default plot().

This is a teeny tiny sample of my 24 hour data:

t,x,y,z
11:04:02:500,-0.4452,-0.5943,-0.7318
11:04:02:600,-0.4452,-0.5384,-0.7836
11:04:02:700,-0.4691,-0.5304,-0.7158
11:04:02:800,-0.4771,-0.5384,-0.7358
11:04:02:900,-0.4651,-0.6103,-0.7557
11:04:03:000,-0.5091,-0.5544,-0.7079
11:04:03:100,-0.4891,-0.6103,-0.7358

After watching some tutorials I installed ggplot 2 and when I try and use it I get this problem.

> library(ggplot2)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called ‘Rcpp’
Error: package or namespace load failed for ‘ggplot2’

What I have tried

  • I have also installed several other packages and they all say the same thing.
  • I have checked the security settings and I have full control,
  • I also updated my version of R,
  • I deleted and re-installed the packages

I'm sorry if this has been asked but I did check on here and YouTube and couldn't find anything.

Any help with this so that I can plot this dataframe as a line graph would be greatly appreciated.

sessionInfo() R version 3.2.3 (2015-12-10) 
Platform: x86_64-w64-mingw32/x64 (64-bit) 
Running under: Windows 10 x64 (build 10586) 

locale: 
  [1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252 
  [3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C 
  [5] LC_TIME=English_United Kingdom.1252 

attached base packages: 
  [1] stats graphics grDevices utils datasets methods base 

loaded via a namespace (and not attached): 
  [1] tools_3.2.3 gtable_0.1.2 grid_3.2.3' 

Re-install Rccp and attempt with library(ggplot2)

    > utils:::menuInstallPkgs()tryingURL
        'https://www.stats.bris.ac.uk/R/bin/windows/contrib/3.2/Rcpp_0.12.3.zip'
    Content type 'application/zip' length 3197565 bytes (3.0 MB) downloaded 3.0 MB

    package ‘Rcpp’ successfully unpacked and MD5 sums checked
    Warning: unable to move temporary installation        
       ‘C:\Users\Destiny\Documents\R\win-library\3.2\file1a7447d175ee\Rcpp’ to 
       ‘C:\Users\Destiny\Documents\R\win-library\3.2\Rcpp’

    The downloaded binary packages are in
        C:\Users\Destiny\AppData\Local\Temp\RtmpimZVXP\downloaded_packages

    > library(ggplot2)
    Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
      there is no package called ‘Rcpp’
    Error: package or namespace load failed for ‘ggplot2’

Quick basic Python graph Example quick little example graph using python

Many thanks for your time

Mike Wise
  • 22,131
  • 8
  • 81
  • 104
  • 7
    Have you tried `install.packages("Rcpp")`? – scoa Jan 12 '16 at 20:58
  • 1
    Please add the output of `sessionInfo()` to your post so we can see what you are working with. – Mike Wise Jan 12 '16 at 21:10
  • You should add this info directly in your question. Also, it seems rcpp is missing, maybe you had an error during installation. you should try it again and post the ouput if there is one. – scoa Jan 12 '16 at 21:49
  • @DestinyLBradley, do you have an example of what the graph should look like, with time plus three variables -- did you mean to have time as x-axis, and each variable being a line of its own color so we have three lines on the graph? – clarity123 Jan 12 '16 at 21:58
  • @user454038 I just added a really quick basic one I just did in python. – Destiny L Bradley Jan 12 '16 at 22:15
  • @MikeWise Thank you for you help, I have included sourceInfo() on the question as indicated by scoa. Many thanks – Destiny L Bradley Jan 12 '16 at 22:17
  • 1
    I think you need to nuke this installation and start over. Maybe even pave the machine. Something went wrong, and it cannot even move files. This is usually very easy to get to work – Mike Wise Jan 12 '16 at 22:28
  • @MikeWise Thank you, I have tried that but cant remember if I deleted all the files... I will uninstall and attempt it again, Is there a reason why it wont plot it as a line graph on just the standard plot()? I assume I'm not giving it enough information, as it is saying that there are too many arguments? Thank you for your time – Destiny L Bradley Jan 12 '16 at 22:38
  • 1
    The problem is you cannot install `Rcpp`. Without that you cannot do anything interesting really. Like `ggplot2`. There is something wrong with your machine. – Mike Wise Jan 12 '16 at 22:39
  • 1
    [One possibility](http://stackoverflow.com/q/5700505/324364) I found simply by Googling your error message. – joran Jan 12 '16 at 22:46
  • Your locale variables look fishy. Try setting them to `en_UK.UTF-8`. – alistaire Jan 13 '16 at 00:00
  • @scoa Your answer is correct. I had this exact same thing happen to me today for some strange reason with the same error message. The solution is to simply reinstall the Rcpp package again as follows: `install.packages("Rcpp")` – hackR Jan 13 '16 at 00:26
  • @MikeWise you were spot on - I think my computer is causing the issue... I added an answer as I now have it working - probably did it arse about face but I'm super happy - thank you all x – Destiny L Bradley Jan 13 '16 at 10:47

1 Answers1

0

I HAVE THE ANSWER.....SORT OF

  • So I uninstalled and deleted R Files
  • I downloaded and tried again to find the same problem
  • In addition I saved R out of the program files.

This did not work:-(

Mike Wise was correct

  • For some reason my computer was corrupting the files
  • It saved them in files that basically didn't exist
  • I copied and pasted the zips in there correct location But this did not work

WHAT DID WORK....**

Possibly an easier way of doing this but this is what we did....

  1. A friend at work downloaded R to his computer and installed the packages Rcpp and ggplot2.
  2. Deleted my R file
  3. Replaced them with his and now it works.... however I haven't yet had time to check if I can install new packages... my assumption is no and that I need....

I need a new laptop:-)

Thank you all very much for your help!!! I hope this helps someone else.

Community
  • 1
  • 1