Featured Post

8 Ways to Optimize AWS Glue Jobs in a Nutshell

Image
  Improving the performance of AWS Glue jobs involves several strategies that target different aspects of the ETL (Extract, Transform, Load) process. Here are some key practices. 1. Optimize Job Scripts Partitioning : Ensure your data is properly partitioned. Partitioning divides your data into manageable chunks, allowing parallel processing and reducing the amount of data scanned. Filtering : Apply pushdown predicates to filter data early in the ETL process, reducing the amount of data processed downstream. Compression : Use compressed file formats (e.g., Parquet, ORC) for your data sources and sinks. These formats not only reduce storage costs but also improve I/O performance. Optimize Transformations : Minimize the number of transformations and actions in your script. Combine transformations where possible and use DataFrame APIs which are optimized for performance. 2. Use Appropriate Data Formats Parquet and ORC : These columnar formats are efficient for storage and querying, signif

How to Execute Commands in R Language

The next step after installing R is how to run commands. You can run directly by entering commands. The other way is you need to write an R script, that contains all the series of commands. The benefit of the script is you can save your commands, it saves your time. Second, as a script, you can run it whenever you need.


#How to Run-commands in R:
#How to Run-commands in R:

Executing Commands in R

Commands can be entered directly into the R console (the window that opens when you start R),
following the red > prompt, and sent to the computer by pressing enter.

For example, typing 1 + 2 and pressing enter will output the result 3:
> 1+2
[1] 3
Your entered code always follows the > prompt, and output always follows a number in square
brackets.
  • Each command should take its own line of code, or else a line of code should be continued with { } 
  • It is possible to press enter before the line of code is completed, and often R will recognize this. For example, if you were to type 1 + but then press enter before typing 2, R knows that 1+ by itself doesn’t make any sense, so prompts for you to continue the line with a + sign. At this point, you could continue the line by pressing 2 then enter. This commonly occurs if you forget to close parentheses or brackets. 
  • If you keep pressing enter and keep seeing a + sign rather than the regular > prompt that allows you to type new code, and if you can’t figure out why, often the easiest option is to simply press ESC, which will get you back to the normal > prompt and allow you to enter a new line of code. 
Capitalization and punctuation need to be exact in R, but spacing doesn’t matter. If you get errors when entering the code, you may want to check for these common mistakes:
  1. Did you start your line of code with a fresh prompt (>)? If not, press ESC.
  2. Are your capitalization and punctuation correct?
  3. Are all your parentheses and brackets closed? For every forward (, {, or [, make sure there is a corresponding backward), }, or ]

R Script

Rather than typing a command in a console, you can create a script using a group of commands.  Code (commands) can be typed here, and then entered into the console in one of three ways:
  1. Copy the code in the R script and paste in the console
  2. Right-click on a line or highlighted group of lines and choose “Run line or selection”
  3. Place your cursor on a line or highlight a group of lines and press CTRL+R. 
The Scripts in R-Language are powerful and re-usable.

Comments

Popular posts from this blog

How to Fix datetime Import Error in Python Quickly

How to Check Kafka Available Brokers

SQL Query: 3 Methods for Calculating Cumulative SUM