List/Grid

Tag Archives: R

Pass parameters in perl script and use it for R script

Pass parameters in perl script and use it for R script

To run a R script from a perl script, this is what you need to do: system(“R CMD BATCH –r_script_name.r r_script_name.out”); //This will execute r_script_name.r from this perl script. Now… Read more »

Passing parameters to a R file (.r file)

Passing parameters to a R file (.r file)

While dealing with a R script, i came across a issue where i needed to send parameters to a R script and use inside my script. With perl its very… Read more »

Unexpected ELSE error – R

Unexpected ELSE error – R

While writing a R code i came across a error: Error in source(“test.r”) : test.r:69:1: unexpected ‘else’ 68: } 69: else ^ My code was something like this: if (… Read more »

Select rows from a data frame on condition – R

Select rows from a data frame on condition – R

Lets say you have a data frame(ds), Here is how top 8 rows look like: > ds[1:8,] agr ppe pe score 1063 3 5.46666 5.61640 1.0000000 1096 7 4.20765 4.83111… Read more »

Write to CSV file without column name – R

If you want to write into csv file a data frame then you might have used this: write.table(data,file=”test.csv”,append=T, row.names=F) where data is you dataframe The issue with this is that… Read more »

Rearrange columns of a data frame – R

Here i will explain how can we rearrange the columns of a data frame and also how can we rename columns. I will use the data frame that i used… Read more »

Add columns in a data frame – R

If you have a data frame and you wish to add a column then here is how you should do it: Lets say your data frame is > data date_… Read more »

Delete rows from a data frame with NA’s

Here is how to delete all the rows from a dataframe where any of the column value had the value NA. For Example, this is my data frame: > data… Read more »

Delete a column from a data frame in R

Here is a quick tip to delete a column from a data frame in R: Lets assume our data frame is: > data code sector industry 1 901 Basic Industries… Read more »

Tips to use data frame in R

Here are some tips to manipulate data frame in R: Lets say the data frame that we have is: > data code sector industry 1 901 Basic Industries Building and… Read more »