Set up R in VS Code for Windows 11 in 2023

Поделиться
HTML-код
  • Опубликовано: 21 авг 2024

Комментарии • 95

  • @kwizeralambert1316
    @kwizeralambert1316 Год назад +5

    This is great, I have been wondering how you configure the R in VSCode. Thank you for this RUclips. You are a great teacher.

    • @milos-makes-maps
      @milos-makes-maps  Год назад +1

      Thank you for your kind words! I’m glad that you found the video helpful. If you have any other questions or suggestions, feel free to let me know. Have a great day!

  • @yifanwu620
    @yifanwu620 Год назад +2

    Im a postgrad and about to start a project in R. Thank u very much!

    • @milos-makes-maps
      @milos-makes-maps  Год назад +1

      Lovely! I hope this tutorial helps you set up R and start the adventure!

  • @mahatmaalimibrahim6631
    @mahatmaalimibrahim6631 Год назад +3

    Always amazing and relevant. A lot of people struggle to set up. Thank you.

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      Thank you for your kind words! I’m glad that I could help. If you have any more questions or need further assistance, please don’t hesitate to ask

    • @mahatmaalimibrahim6631
      @mahatmaalimibrahim6631 Год назад +1

      Thank you brother. So nice of you. Your generousity of knowledeg sharing, the quality of your presentation, and making sense of messed up data is unmatched. @@milos-makes-maps

  • @kevon217
    @kevon217 3 месяца назад +1

    Exactly what I was looking for. Appreciate it!

    • @fosimuboolubo8891
      @fosimuboolubo8891 3 месяца назад

      Good day. Did you R extension settings in vsCode contain RPath, cause mine did not.

  • @Aaqib..
    @Aaqib.. Год назад +2

    Ok this is something i was considering but didn't know where to start, grateful as always. Love the thumbnail btw💪🏻😂

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      Hahaha, glad I hit the target 🎯 😂. Let me know how it goes 😉

  • @lbarq
    @lbarq Год назад +1

    Thank you for the excellent tutorial. I use VS code to program in many programming languages, and knowing that it's possible for R is really nice. I will try it for sure

    • @milos-makes-maps
      @milos-makes-maps  Год назад +1

      You’re welcome! I’m glad that you found the tutorial helpful. It’s great to hear that you use VS Code for programming in many languages. I hope that you find it just as useful for R. If you have any questions or need further assistance, please don’t hesitate to ask

  • @AleksPopovic
    @AleksPopovic 11 месяцев назад +1

    Great one Milos, we need more videos like this!

  • @tornikeb8872
    @tornikeb8872 7 месяцев назад +1

    Thank you! Very detailed and useful tutorial!

  • @solarenergynow08
    @solarenergynow08 9 месяцев назад +2

    This is the best video that solved my installation issue: Working with R in VS Code for Windows 10, R Version 4.3.2. The Settings part in Win10 are different to access but are named the same as in Win11. Thanks. Now dealing with execution issues...
    Im Stuck with "Failed to get list of R functions. Make sure that `jsonlite` is installed and r.rpath.windows points to a valid R executable" AND "Error: '\U' used without hex digits in character string (:4:36) Execution halted". Have tried everything on the comments but cannot solve it..any guidance is welcome.

    • @milos-makes-maps
      @milos-makes-maps  9 месяцев назад

      Wow, I was just about to write my response to your previous question! Happy that you successfully resolved it. I'm glad you found the video helpful. Working with R in VS Code is a great way to improve your productivity and efficiency. Thank you for sharing your feedback and tips on how to access the settings in Windows 10. I appreciate your support and enthusiasm. 😊

    • @solarenergynow08
      @solarenergynow08 9 месяцев назад +1

      @@milos-makes-maps Appreciate your getting back to me...I could not make VS Code work so I am working with RStudio... I am trying to use VS Code 1.84.1 with R 4.3.2 but there's just too many issues right now.(per my comment above. )

    • @milos-makes-maps
      @milos-makes-maps  9 месяцев назад

      @@solarenergynow08 let's try to debug it together. Starting from the first error it complains about jsonlite not being installed. Can you check if that's true? Also, can you check the pathway to the library where jsonlite is installed?

    • @BboyDaquack
      @BboyDaquack 2 месяца назад

      @@milos-makes-maps Did you ever figure this out? I made sure the pathway was correct and jsonlite is installed. still get the same errors.

    • @ahmadkura9503
      @ahmadkura9503 2 месяца назад

      Having same issues. Were you able to resolve it??

  • @sweven9515
    @sweven9515 7 месяцев назад +9

    thank you for this amazing tutorial but i have an error when running the " > languageserversetup::languageserver_install() " command
    the error reads : Error: Failed to install 'languageserver' from GitHub
    any solutions?

    • @Snaggletooth44
      @Snaggletooth44 4 месяца назад +3

      try running "Rgui" as administrator

    • @designedbyckb5427
      @designedbyckb5427 2 месяца назад

      @@Snaggletooth44 had the same issue as @sweven9515. Thank you for your help here

  • @iliasaretos
    @iliasaretos Год назад +2

    Thanks a lot for your excellent video tutorial!!! I used to work with RStudio, nevertheless it became so much “heavy” and I believe that VS Code is the only serious alternative. I have a short question: How can I use the Ctrl + Shift + M for the %>% pipe? Thanks in advance!!!

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      Hi @iliasaretos7442, I’m glad you enjoyed the RStudio tutorial!! VS Code is indeed a great alternative for working with R. For pipe %>% either type % and then TAB or use ctrl+shift+m shortcut in VSCode

  • @emirhandemir3872
    @emirhandemir3872 6 месяцев назад +1

    Hell yeah, I agree! I have no idea what I am agreeing but YES, I AGREE !

  • @oluwafemioyedele
    @oluwafemioyedele Год назад +1

    Nice, l use radian before to integrate R with VS code but I really love your step!!@

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      Thank you for your kind words! I’m glad that you found the tutorial helpful. It’s great to hear that you’ve used radian before to integrate R with VS Code. I hope that you find this method just as useful. If you have any questions or need further assistance, please don’t hesitate to ask

    • @oluwafemioyedele
      @oluwafemioyedele Год назад

      @@milos-makes-maps When I run languageserversetup::languageserver_install() : I get the following error:
      The command ‘wmic process where processid=5580 get commandline’ cannot run successfully. Please make sure the software is available to use the package. Any suggestion ?

    • @oluwafemioyedele
      @oluwafemioyedele Год назад

      I have been able to fix this, I discovered that there was a bug with windows

  • @ronaldfranck2351
    @ronaldfranck2351 5 месяцев назад +1

    A big thank

  • @kwizeralambert1316
    @kwizeralambert1316 Год назад +1

    This is amazing, thank you.

    • @milos-makes-maps
      @milos-makes-maps  Год назад +1

      My pleasure! I hope it'll work for you. Let me know how it goes 😉

    • @kwizeralambert1316
      @kwizeralambert1316 Год назад +1

      @@milos-makes-maps I actually I have R, and VSCODE installed in my machine, but I have never had attempted to run R via VSCODE. I will try and see how it goes. I will let you know and give you suggestions

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      @@kwizeralambert1316 Thanks!

  • @user-ys9yu4mg5x
    @user-ys9yu4mg5x Месяц назад +1

    Just got a problem but resolved by myself is, when in the RGui, run: "languageserversetup::languageserver_install()" will cause an error, if not install Rtools. So install Rtools first before the tutorial.

    • @milos-makes-maps
      @milos-makes-maps  Месяц назад

      Thanks for the tip! Can you share the error message?

  • @Keroxez
    @Keroxez 8 месяцев назад +1

    Thank you for the video, man. I got stuck in the R setup because I'm using WSL, I suppose. Does that mean I should install R on my Ubuntu subsystem instead of Windows to use it? If so, I would appreciate some guidance. Thank you!

    • @milos-makes-maps
      @milos-makes-maps  8 месяцев назад

      Hey, sorry to hear that but I haven't used Linux

  • @johannesdoermer840
    @johannesdoermer840 10 месяцев назад +3

    When I try to download the packages with ("languageserversetup") the terminal prints: 'lib = "C:/Program Files/R/R-4.3.1/library" ' is not writable & it asks me if I want to use a personal library instead? What does this mean?

    • @milos-makes-maps
      @milos-makes-maps  10 месяцев назад +1

      This means that you do not have permission to install packages in the default library location, which is usually reserved for system-wide packages. You have two options to fix this error:
      - You can answer yes to the question and create a personal library in your home directory, where you can install packages for your own use. This is the easiest and safest option, as it does not require changing any system settings or permissions.
      - You can change the permission of the default library location or add yourself to the staff group, so that you can write to it. This option may require administrator privileges or sudo access, and it may affect other users or programs that use R on your computer.

    • @solarenergynow08
      @solarenergynow08 9 месяцев назад

      @@milos-makes-maps Hello, I had the same error; clicked "Yes", then selected the "cloud" option it started the download briefly and got this error: Error: unable to create temporary directory ‘C:\Program Files\R\R-4.3.2\library\filed787c0e7f64’ In addition: Warning message: In dir.create(tmpDir) : cannot create dir 'C:\Program Files\R\R-4.3.2\library\filed787c0e7f64', reason 'Permission denied'
      Solved issue by running the console as an administrator BUT now having issues with the " add to rprofile()" part: languageserversetup::languageserver_add_to_rprofile() Error in loadNamespace(x) : there is no package called ‘languageserversetup’ AND tried also: > languageserver::languageserver_add_to_rprofile() Error: 'languageserver_add_to_rprofile' is not an exported object from 'namespace:languageserver'
      Appreciate some help/guidance.. Edited: Solved...retyped the instruction again and it went through....maybe a space made the difference...Thanks

    • @yashsindhu9520
      @yashsindhu9520 7 месяцев назад

      I am having the same issue please tell how to create a library .HELP PLEASE.......
      @@milos-makes-maps

    • @RenegadeZac
      @RenegadeZac 5 месяцев назад +1

      @@yashsindhu9520 I know this is a month late but I had this issue and simply resolved it by running R as an administrator

  • @chris7263
    @chris7263 2 месяца назад

    My problem might be that I’d already installed everything before watching this tutorial following other instructions, but it seemed like it was all working the same until you got to the end and then I couldn’t find the specific “rPath” settings in REditor? I’ve got most of the same ones as you do, but not those.

  • @Keving-fv3wp
    @Keving-fv3wp 2 месяца назад +1

    Whenever i open up the RGui, I'm prompted with the error message: '\i' is an unrecognized escape in character string (:4:43). I've been stuck at this part for a couple of hours and tried to research solutions but a no go. Anyone know anything that might work?

    • @milos-makes-maps
      @milos-makes-maps  Месяц назад

      The error message you’re seeing in RGUI suggests that there’s an issue with an escape character in a string. In R, backslashes (\) are used as escape characters, which means they have a special meaning when used within strings. If you want to include a literal backslash in a string, you need to escape it by using two backslashes (\\).
      This error often occurs when setting file paths on Windows systems where the backslash is the default directory separator. If you’re setting a file path or working directory in your R profile or an R script that runs on startup, make sure all backslashes are properly escaped.
      If you’re not sure where the error is coming from, check any .Rprofile or .Renviron files in your home directory or R’s home directory, as well as any scripts or commands that run when R starts up.
      If the issue persists, you might want to consider using the file.path() function to construct file paths, as it automatically uses the correct file separator for your operating system:
      file.path("C:", "myfolder", "myfile")

  • @bryanlee3197
    @bryanlee3197 9 месяцев назад +2

    Error: '\U' used without hex digits in character string (:4:36)
    Execution halted
    Im having this problem. I dont know what wend wrong. Just follow your procedure

    • @bryanlee3197
      @bryanlee3197 9 месяцев назад +1

      it works now i change the rprofile from \ to /.

    • @yashkumar6623
      @yashkumar6623 7 месяцев назад

      @@bryanlee3197 how did you fix this? can you explain a bit?

    • @bryanlee3197
      @bryanlee3197 7 месяцев назад

      @@yashkumar6623 i just updatr my rprofile and json file.

  • @reinadavisaoki8230
    @reinadavisaoki8230 Месяц назад

    I am stuck with the opening up the R terminal part on VS code. The error message I get is "Cannot find R for creating R terminal. Change setting r.rterm.windows to R path." Any suggestions?

  • @andrea-mj9ce
    @andrea-mj9ce Год назад +1

    When I click on "R Terminal", I get the error message
    _The terminal process failed to launch: Path to shell executable "PATH\\R\\R-4.1.2\\bin\\x64\\R.exe" does not exist._

    • @milos-makes-maps
      @milos-makes-maps  Год назад +1

      Hey, this message suggests that the path to R executable is incorrect. Are you getting this error when you try to open a new R terminal in VS code? If yes, then you need to find the path to the folder with R exe on your local drive and enter this path in Rpath Windows, which is in Extensions -> R -> settings

    • @andrea-mj9ce
      @andrea-mj9ce Год назад +1

      ​@@milos-makes-maps Indeed, I added the R path and the R term, and now it works. For info, I used a double backslah for the path '\\'

    • @pinkyc7328
      @pinkyc7328 8 месяцев назад

      I don’t find R document in the new file list

  • @ramasama
    @ramasama 3 месяца назад

    Thanks for the video. This is very detailed. I have one problem though during the installation of server language I get the following error:
    Error in dir.exists(rlsLib) :
    file name conversion problem -- name too long?
    Not doing anything, returning FALSE.
    My user folder has a character with an accent (í) I don't know if that could be the problem. I'm running it on windows 11. Do you have any idea how to resolve this?

    • @milos-makes-maps
      @milos-makes-maps  3 месяца назад

      The issue you're encountering seems to be related to a file name conversion problem, specifically an error stating "name too long" or a potential issue with special characters in the file path as you suggested. This can occur when the file path exceeds the maximum length allowed by the system or contains characters that are not recognized properly.
      To resolve this, you can try the following steps:
      1. Shorten the File Path: Try moving the file to a directory with a shorter path and see if that resolves the issue.
      2. Remove Special Characters: If your file path includes special characters, especially non-English ones, try renaming folders or files to remove them.
      3. Check File System Limitations: Different file systems have different limitations on file path lengths. Ensure that your file system supports the length of your file path.
      4. Update R and Packages: Make sure you are using the latest version of R and all relevant packages, as updates often include bug fixes for issues like these.

  • @burakt
    @burakt Год назад +1

    Hi Milos, first of all thank you for this nice setup explanation. I wrote install.packages("languageservertup") in R Console, but this error came: Error: unable to create temporary directory ‘C:\Program Files\R\R-4.3.1\library\file3bf4617e185b’
    In addition: Warning message: In dir.create(tmpDir) : cannot create dir 'C:\Program Files\R\R-4.3.1\library\file3bf4617e185b', reason 'Permission denied'

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      Hi Burak and thank you! It seems that you are having trouble creating a temporary directory in R console due to permission issues. Can you run the R console as an administrator? This will give you full access to the file system and avoid permission errors.

    • @solarenergynow08
      @solarenergynow08 9 месяцев назад +1

      @@milos-makes-maps Hi, you'd have to run R as an Admin everytime you want to install packages, it is better to change permissions to the library folder using windows explorer (right click on folder. tab security and so on (plenty of how to videos ...). Worked for me and have not seen any setbacks...

    • @2sidessas334
      @2sidessas334 2 месяца назад

      @@milos-makes-maps Running Rgui solved the problem!!.

  • @boredom730
    @boredom730 5 месяцев назад

    is there an environment tab for vscode just like the rstudio? i think environment pane is very important especially when scraping or saving objects

    • @milos-makes-maps
      @milos-makes-maps  5 месяцев назад

      What is the environment tab? I never used RStudio

  • @lillalaurakis1514
    @lillalaurakis1514 10 месяцев назад +1

    i get this error message Error: '\U' used without hex digits in character string (~/.Rprofile:4:36) i dot know wheres the problem

    • @milos-makes-maps
      @milos-makes-maps  10 месяцев назад

      Hi, R complains about using a backslash (\\) in the file path, which causes the error: Error: 'U' used without hex digits in character string (~/.Rprofile:4:36). This is because the backslash is used to indicate special characters or hexadecimal numbers in R, and the letter U does not have a special meaning. There are two ways to fix this error:
      - Use forward slashes (/) instead of backslashes in the file path. For example, instead of writing ~/.Rprofile, write ~/Rprofile.
      - Use double backslashes (\\\\) instead of single backslashes in the file path. For example, instead of writing ~/.Rprofile, write ~\\.Rprofile.
      Can you find out where the error pops up?

    • @lillalaurakis1514
      @lillalaurakis1514 10 месяцев назад +1

      @@milos-makes-maps the error message pops out whenever I try to use R in VS. Can you tell me wich pathways I need to change? The one in the R settings or the one in my windows enviroment variables?

    • @milos-makes-maps
      @milos-makes-maps  10 месяцев назад

      Hey, try to find the path to the folder with R.exe on your local drive and change the path in Rpath Windows, which is in Extensions -> R -> settings

    • @solarenergynow08
      @solarenergynow08 9 месяцев назад +1

      Same here. Cannot figure it out yet.@@milos-makes-maps

    • @milos-makes-maps
      @milos-makes-maps  9 месяцев назад +1

      Does the below tip help?
      - Use forward slashes (/) instead of backslashes in the file path. For example, instead of writing ~/.Rprofile, write ~/Rprofile.

  • @fauziyahya001
    @fauziyahya001 8 месяцев назад

    How many times have I tried to install it but it still doesn't work?

    • @milos-makes-maps
      @milos-makes-maps  8 месяцев назад

      Hey, can you specify where the issue occurs?

  • @samuelbrown9634
    @samuelbrown9634 9 месяцев назад +1

    Hello @milo-makes-maps thank you for the tutorial, please I'm having this issue, languageserversetup::languageserver_install()
    Error in languageserversetup::languageserver_install() :
    The command ‘wmic process where processid=8396 get commandline’ cannot run successfully.
    Please make sure the software is available to use the package.
    Can you please assist me. Thank You

    • @milos-makes-maps
      @milos-makes-maps  9 месяцев назад

      Hey, are you getting this error on Windows?

    • @samuelbrown9634
      @samuelbrown9634 9 месяцев назад +1

      @@milos-makes-maps Yes I am, Windows 10

    • @milos-makes-maps
      @milos-makes-maps  9 месяцев назад

      @@samuelbrown9634 The error message says that the command 'wmic process where processid=8396 get commandline' cannot run successfully. This command is used to get the command line arguments of a process with a given process ID.
      According to the web search results, this error may be due to the fact that you do not have the libcurl package installed on your system. This package is required for the curl package in R, which is a dependency of the languageserver package. Check if the libcurl package is installed. Otherwise you need to install it.
      After installing it, you can try to install the languageserver.
      I hope this helps you debug your issue. If you have any other questions, please feel free to ask me. 😊

    • @samuelbrown9634
      @samuelbrown9634 9 месяцев назад

      @@milos-makes-maps Thank you so much for your help and feedback

    • @samuelbrown9634
      @samuelbrown9634 9 месяцев назад

      @@milos-makes-maps I've tried installing libcurl package the output was "A version of this package for my intalled R is not available.

  • @joseeduardomartinezsanchez3535
    @joseeduardomartinezsanchez3535 10 месяцев назад

    Hi, I'm getting this error message when trying to install the languageserver package:
    Installing package into ‘C:\Users\jose.martinez\OneDrive\Documents/languageserver-library’
    (as ‘lib’ is unspecified)
    * installing *source* package 'languageserver' ...
    ** using staged installation
    ** libs
    Error in system(paste(MAKE, p1(paste("-f", shQuote(makefiles))), "compilers"), :
    'make' not found
    * removing 'C:/Users/jose.martinez/OneDrive/Documents/languageserver-library/languageserver'

    • @milos-makes-maps
      @milos-makes-maps  10 месяцев назад

      You don't have compilers and/or build tools on your machine. What is your OS?

    • @joseeduardomartinezsanchez3535
      @joseeduardomartinezsanchez3535 10 месяцев назад

      @@milos-makes-maps my OS is Windows 10

    • @milos-makes-maps
      @milos-makes-maps  10 месяцев назад

      The error message indicates that you don't have the make utility installed on your Windows 10 system. Make is a tool that helps you compile and build programs from source code. You need to install make before you can install the languageserver package. There are different ways to install make on Windows 10. You can use a package manager like Chocolatey or Winget, or you can download and install it manually from GnuWin32