Trending 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 darklord
• 6,170 points
35 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 10, 2018 in Data Analytics by zombie
• 3,690 points
29 views
0 votes
1 answer

Plot two variables as lines on the same graph using ggplot

If you have small number of variables, ...READ MORE

Apr 17, 2018 in Data Analytics by kappa3010
• 2,020 points
1,032 views
0 votes
1 answer

How can I left align two graph edges?

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

May 10, 2018 in Data Analytics by zombie
• 3,690 points
14 views
0 votes
1 answer

Grouping rows in a list in pandas (python) groupby

Yes this possible by using groupby to group on ...READ MORE

May 3, 2018 in Data Analytics by DeepCoder786
• 1,720 points
314 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,690 points
48 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,690 points
29 views
0 votes
2 answers

Vector vs List in R

Well, you are right in  saying that ...READ MORE

May 8, 2018 in Data Analytics by anonymous
34 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 8, 2018 in Data Analytics by zombie
• 3,690 points
56 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,550 points
39 views
0 votes
1 answer

How can I learn R?

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

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

How to drop factor levels in a subsetted data frame?

You can use factor(ff) to drop levels ...READ MORE

Apr 17, 2018 in Data Analytics by kappa3010
• 2,020 points

edited Apr 17, 2018 by kappa3010 896 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,550 points
37 views
0 votes
1 answer

How can I remove plot axis values?

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

May 7, 2018 in Data Analytics by zombie
• 3,690 points
20 views
0 votes
1 answer

Calculating accuracy of prediction of rpart model

Your first task would be to build ...READ MORE

Apr 4, 2018 in Data Analytics by Bharani
• 4,550 points
1,441 views
0 votes
1 answer

How to extract specific columns from a DataFrame ?

Yes there are so many ways: df[,c(V2,V4)] and another ...READ MORE

Apr 11, 2018 in Data Analytics by DeepCoder786
• 1,720 points
1,090 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,020 points
387 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 19, 2018 in Data Analytics by zombie
• 3,690 points
698 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,550 points
39 views
0 votes
1 answer

How to convert dataframe columns from factors to characters?

To replace all the variables to character ...READ MORE

Apr 13, 2018 in Data Analytics by BHARANI
• 410 points
911 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,020 points
25 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,580 points
40 views
0 votes
1 answer

R - Error: Duplicate identifiers for rows

You can try the below code as ...READ MORE

Apr 9, 2018 in Data Analytics by kappa3010
• 2,020 points
1,018 views
0 votes
1 answer

How to rename columns in pandas (Python)?

It is easy by just adding ".columns" ...READ MORE

Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points
108 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 darklord
• 6,170 points
79 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
494 views
0 votes
1 answer

Read command line parameters from an R script

Here's an example to explain : Two files ...READ MORE

Apr 17, 2018 in Data Analytics by kappa3010
• 2,020 points
621 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 26, 2018 in Data Analytics by shams
• 3,580 points
214 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 24, 2018 in Data Analytics by DeepCoder786
• 1,720 points
286 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
191 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,690 points
527 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 24, 2018 in Data Analytics by DeepCoder786
• 1,720 points
200 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,550 points
36 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 26, 2018 in Data Analytics by darklord
• 6,170 points
33 views
0 votes
1 answer

How to set global variables in R

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

Apr 23, 2018 in Data Analytics by kappa3010
• 2,020 points
112 views
0 votes
1 answer

How to create dummy variables based on a categorical variable of lists in R?

You can use mtabulate in the following way: library(qdapTools) cbind(data[1], ...READ MORE

Apr 13, 2018 in Data Analytics by CodingByHeart77
• 3,690 points
541 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,580 points
31 views
0 votes
1 answer

Sample random rows in DataFrame in R

First we should have some data: df1<-data.frame(matrix(rnorm(20), nrow=10)) > ...READ MORE

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

R function for finding the index of an element in a vector?

Yes, we can find the index of ...READ MORE

Apr 13, 2018 in Data Analytics by zombie
• 3,690 points
480 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 23, 2018 in Data Analytics by zombie
• 3,690 points
32 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
37 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 23, 2018 in Data Analytics by zombie
• 3,690 points
23 views
0 votes
1 answer

How can I measuring running time of R Code ?

5 ways to measure running time of ...READ MORE

Apr 17, 2018 in Data Analytics by anonymous
286 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,690 points
83 views
0 votes
1 answer

How to change font size of text and axes on R plots ?

To change the font size of text, ...READ MORE

Apr 20, 2018 in Data Analytics by zombie
• 3,690 points
73 views
0 votes
1 answer

Unload a package without restarting R

Try the below option: detach("package:vegan", unload=TRUE) NOTE: You can ...READ MORE

Apr 17, 2018 in Data Analytics by DataKing99
• 8,130 points
187 views
0 votes
1 answer

How to find out the sum/mean for multiple variables per group in R?

You can use the reshape2 package for ...READ MORE

Apr 12, 2018 in Data Analytics by DataKing99
• 8,130 points
382 views
0 votes
1 answer

Rename a single column in dataframe using R

colnames(Samp)[2] <- "newname2" This sets the name of ...READ MORE

Apr 13, 2018 in Data Analytics by kappa3010
• 2,020 points
341 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
23 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,020 points
60 views