Most answered questions in Data Analytics

0 votes
1 answer

Any filter based on conditional criteria in r?

Consider a data frame like this: #Create DF ...READ MORE

May 11, 2018 in Data Analytics by Sahiti
• 6,370 points
1,983 views
0 votes
1 answer

R lag irregular time series data

You could try using: library(dplyr) library(zoo) na.locf(ts$value[sapply(ts$time, function(x) min(which(ts$time - ...READ MORE

May 11, 2018 in Data Analytics by Sahiti
• 6,370 points
798 views
0 votes
1 answer

How can I use R to list all files with a specified extension ?

fls <- list.files(pattern = "\\.dbf$") $ at the ...READ MORE

May 11, 2018 in Data Analytics by zombie
• 3,790 points
680 views
0 votes
1 answer

How can I left align two graph edges?

By using a modified version of rbind.gtable ...READ MORE

May 11, 2018 in Data Analytics by zombie
• 3,790 points
360 views
0 votes
1 answer

How can I print string and variable contents on the same line using R?

There are two options for doing so.  You ...READ MORE

May 9, 2018 in Data Analytics by zombie
• 3,790 points
1,664 views
0 votes
1 answer

How can I select a CRAN mirror in R ?

There are many ways of doing so ...READ MORE

May 9, 2018 in Data Analytics by zombie
• 3,790 points
750 views
0 votes
1 answer

How can I append rows to an R data frame?

Consider a dataSet i.e cicar(present under library ...READ MORE

May 9, 2018 in Data Analytics by zombie
• 3,790 points
10,500 views
0 votes
1 answer

How can I learn R?

As the name signifies it's only an ...READ MORE

May 9, 2018 in Data Analytics by zombie
• 3,790 points
309 views
0 votes
1 answer

How to stack scatterplot in ggplot2?

Use melt() to reshape your data with total as a factor ...READ MORE

May 8, 2018 in Data Analytics by Sahiti
• 6,370 points
2,263 views
+1 vote
1 answer

How to change fill color in each facet using ggplot2?

You can map the facetting variable to ...READ MORE

May 8, 2018 in Data Analytics by kappa3010
• 2,090 points
24,729 views
0 votes
1 answer

Changing the column type from numeric to factor - R

You can use the as.factor() function for ...READ MORE

May 8, 2018 in Data Analytics by Bharani
• 4,660 points
957 views
0 votes
1 answer

How can I remove plot axis values?

In order to remove numbering on x-axis ...READ MORE

May 8, 2018 in Data Analytics by zombie
• 3,790 points
433 views
0 votes
1 answer

How to drop rows of Pandas DataFrame whose value in certain coulmns is NaN

Hi@DataKing99, You can create one function according to ...READ MORE

May 7, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 9, 2020 by MD 1,484 views
0 votes
1 answer

Deleting particular objects from workspace - R

You can use the rm() function to ...READ MORE

May 7, 2018 in Data Analytics by Bharani
• 4,660 points
567 views
0 votes
1 answer

Discarding duplicate rows from a data.frame - R

You can use distinct() function along with ...READ MORE

May 4, 2018 in Data Analytics by Bharani
• 4,660 points
517 views
0 votes
1 answer

Extracting numeric columns from a data.frame - R

You can use the select_if() function from ...READ MORE

May 4, 2018 in Data Analytics by Bharani
• 4,660 points
7,530 views
0 votes
1 answer

How to delete DataFrame row in pandas based upon a column value?

You can use drop function in your ...READ MORE

May 3, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 9, 2020 by MD 1,446 views
0 votes
1 answer

How to print new lines with print() in R?

You can use cat() instead of writeLines(): ...READ MORE

May 3, 2018 in Data Analytics by kappa3010
• 2,090 points
603 views
0 votes
1 answer

How can I label points in geom_point?

Use geom_text , with aes label. You ...READ MORE

May 8, 2018 in Data Analytics by zombie
• 3,790 points
5,330 views
0 votes
1 answer

Grouping rows in a list in pandas (python) groupby

Yes, this possible by using groupby function ...READ MORE

May 3, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 8, 2020 by MD 1,130 views
0 votes
1 answer

How can I control the size of points in an R scatterplot?

plot(variable, type='o' , pch=5, cex=.3) The pch argument ...READ MORE

May 3, 2018 in Data Analytics by shams
• 3,670 points
1,079 views
0 votes
1 answer

How to order data frame rows according to vector with specific order using R?

You can try using match: data <- data.frame(alphabets=letters[1:4], ...READ MORE

Apr 30, 2018 in Data Analytics by Sahiti
• 6,370 points
6,905 views
0 votes
1 answer

How to add leading zeros in R?

There are several solutions to this. One of ...READ MORE

Apr 30, 2018 in Data Analytics by Sahiti
• 6,370 points
24,017 views
0 votes
1 answer

What is the Difference in Size and Count in pandas (python)?

The major difference is "size" includes NaN values, ...READ MORE

Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 8, 2020 by Gitika 2,524 views
0 votes
1 answer

How to rename columns in pandas (Python)?

You can use the rename function in ...READ MORE

Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 8, 2020 by MD 1,680 views
0 votes
1 answer

How to export a graph to .eps file with R?

The easiest way that I could suggest ...READ MORE

Apr 27, 2018 in Data Analytics by Sahiti
• 6,370 points
4,636 views
0 votes
1 answer

Catch integer(0) in R

R's way of printing a zero length ...READ MORE

Apr 27, 2018 in Data Analytics by kappa3010
• 2,090 points
4,015 views
0 votes
1 answer

Aligning title in ggplot2

You can use the theme layer to ...READ MORE

Apr 27, 2018 in Data Analytics by Bharani
• 4,660 points

edited Jun 9, 2020 by MD 3,476 views
0 votes
1 answer

data.frame vs matrix

Yes, both matrix and data.frame are multidimensional ...READ MORE

Apr 27, 2018 in Data Analytics by Bharani
• 4,660 points
773 views
0 votes
1 answer

How to find common elements from multiple vectors in R?

Reduce(intersect, list(a,b,c)) READ MORE

Apr 27, 2018 in Data Analytics by DeepCoder786
• 1,720 points
5,586 views
0 votes
1 answer

How can I remove duplicated rows in R ?

The function distinct() in the dplyr package ...READ MORE

Apr 27, 2018 in Data Analytics by shams
• 3,670 points
2,727 views
0 votes
1 answer

How can I delete multiple values from a vector in R?

The %in% operator tells  which elements are ...READ MORE

Apr 27, 2018 in Data Analytics by shams
• 3,670 points
5,974 views
0 votes
1 answer

How to subset data so that it contains only columns whose names match a condition

You can use grepl on the names ...READ MORE

Apr 27, 2018 in Data Analytics by Sahiti
• 6,370 points
6,050 views
0 votes
1 answer

How to import data from a Json file into R?

Easy and simple: library("rjson") json_file <- "file_name" json_data <- fromJSON(file=json_file)) or ...READ MORE

Apr 26, 2018 in Data Analytics by DeepCoder786
• 1,720 points
2,072 views
0 votes
1 answer

What is the standard naming convention for the variables in R?

Use of period separator e.g. product.prices <- c(12.01, ...READ MORE

Apr 25, 2018 in Data Analytics by shams
• 3,670 points
465 views
0 votes
1 answer

How can I define Global Variables in R?

The variables declared inside a function are ...READ MORE

Apr 25, 2018 in Data Analytics by shams
• 3,670 points
5,761 views
0 votes
1 answer

How to wait for a keypress in R?

It is easy by using readline readline(prompt="Press any ...READ MORE

Apr 25, 2018 in Data Analytics by DeepCoder786
• 1,720 points
1,472 views
0 votes
1 answer

How to remove all variables except functions in R?

One line that removes all objects except for functions: rm(list ...READ MORE

Apr 25, 2018 in Data Analytics by DeepCoder786
• 1,720 points
3,669 views
0 votes
1 answer

How to set global variables in R

To set global variables, you can use ...READ MORE

Apr 24, 2018 in Data Analytics by kappa3010
• 2,090 points
1,027 views
0 votes
1 answer

How do I find out what directory R has chosen to store packages?

.libPaths() // You can use this command ...READ MORE

Apr 24, 2018 in Data Analytics by zombie
• 3,790 points
394 views
0 votes
1 answer

Why should I use set.seed function() in R?

set.seed(seed) Set the seed of R‘s random number ...READ MORE

Apr 24, 2018 in Data Analytics by zombie
• 3,790 points
1,636 views
0 votes
1 answer

How to import text file as a single character string?

First way: rd<-readChar("temp.txt",file.info("temp.txt")$size) ...READ MORE

Apr 23, 2018 in Data Analytics by DeepCoder786
• 1,720 points
1,058 views
0 votes
1 answer

How to convert tables to a data frame in R ?

> trial.table.df <- as.data.frame(trial.table) //assuming that trial.table ...READ MORE

Apr 20, 2018 in Data Analytics by zombie
• 3,790 points
7,224 views
0 votes
1 answer

How to prevent row names to be written to a file while using

Easily by: write.csv(df, "temp.csv", row.names=FALSE) READ MORE

Apr 20, 2018 in Data Analytics by DeepCoder786
• 1,720 points
510 views
0 votes
1 answer

How to save a DataFrame in R??

Suppose your DataFrame is named as df: write.csv(df,file="exmp.csv") Then ...READ MORE

Apr 20, 2018 in Data Analytics by DeepCoder786
• 1,720 points
4,843 views
0 votes
1 answer

How can I import multiple .csv files into R ?

## import_multiple_csv_files_to_R # Purpose: Import multiple csv files ...READ MORE

Apr 20, 2018 in Data Analytics by zombie
• 3,790 points
6,005 views
0 votes
1 answer

How to limit output of a dataframe in R?

For randomly sampling a row/cell where a ...READ MORE

Apr 18, 2018 in Data Analytics by kappa3010
• 2,090 points
2,919 views
0 votes
1 answer

How to join columns that are non-NA?

You can match on something like X=X ...READ MORE

Apr 18, 2018 in Data Analytics by Sahiti
• 6,370 points
582 views
0 votes
1 answer

How to find out the package version which is loaded in R?

You can use sessionInfo() to accomplish that. > ...READ MORE

Apr 18, 2018 in Data Analytics by zombie
• 3,790 points
563 views
0 votes
1 answer

How can we trim leading and trailing whitespaces in R?

trimws {base} //Remove Leading/Trailing Whitespace Removes leading and/or ...READ MORE

Apr 18, 2018 in Data Analytics by zombie
• 3,790 points
1,823 views