Quantcast
Channel: Active questions tagged r - Stack Overflow
Browsing all 204742 articles
Browse latest View live
↧

Plotting a chessboard in R. How to name columns and rows?

I wrote the function, that draws chessboards. I want to name each column and row using the letters. But, I don't know how to do this.My code:chessboard=function(n){ if(1<=n & n<=26){...

View Article


List R variable names and their SEXP in the global env during debugging of...

The context of this question is debugging of an R packages that calls C or C++ code (eg. via the package Rcpp or directly using the R API) by using gdb (or another) debugger.How can I list the variable...

View Article


Find length of each factor in a column in a data frame [duplicate]

This question already has an answer here:Using nchar function on factor variables 3 answersI have a data frame with which is the wordcount of each word in a text file, so > head(wordcount) word freq...

View Article

Is there a function in R that will let me convert a dataset into "long...

I have a dataset derived from Pokemon statistics containing a lot of the numerical and categorical data. My end goal is to create a model or recommendation system that a user can input a list of...

View Article

Reverse of Yeo Johnson variable transformation done by preprocess function in...

I have done a Yeo Johnson transformation by using preprocess from caret package. I have predicted the Target Variable using linear regression. Now I want to reverse the transformation for both the...

View Article


geosphere::areaPolygon returns different results based on ordering of vertices

I am trying to calculate the area of a polygon defined in terms of latitude and longitude:example_polygon <- data.frame( lat = c(42.7093213,42.7079761,42.7093941,42.7080938,42.7093213), lon =...

View Article

How to add legend to plot with data from multiple data frames

I have scripted a ggplot compiled from two separate data frames, but as it stands there is no legend as the colours aren't included in aes. I'd prefer to keep the two datasets separate if possible, but...

View Article

change data frame into another data frame with 1 and 0

I have data frame dat1 and I want to have data frame dat2. How convert this data frame dat1 to dat2 build 1 and 0.s <- c("A","B","C","D","E") h <- c("H1","H2","H1","H3","H4") dat1 <-...

View Article


"Error in: Length of logical index vector" when creating ggvis stack bar...

I am trying to build a shiny dashboard which has a chart and a HTML5 DataTable from DT Package below the chart. The chart is connected to the DataTable such that filtering the DataTable will filter the...

View Article


Need help plotting a ggplot of percentage of categories in a dataframe in R

I have a data frame, that has some number of columns. Each of these columns has values that are categorical - Yes, Neutral and No. An example of the dataframe is below:a = c('yes', 'yes', 'no',...

View Article

Is there a way to use a function that takes a matrix as argument in a dplyr pipe

I'm evaluating the test-retest reliability of a questionnaire. I've got more than 200 pairs of variables (nominal, ordinal, or numeric), each measured at test and retest, for whom I compute a...

View Article

Image may be NSFW.
Clik here to view.

Resize plot with multiple graphs in R [duplicate]

This question already has an answer here:How to define fixed aspect-ratio for scatter-plot 2 answersMy Problem is, that I'd like to make the scatterplots from my base-R plot output way smaller and...

View Article

Image may be NSFW.
Clik here to view.

How to not display values in the nodes or the links in SankeyDiagram using...

In the sankeydiagram example below, is there anyway to hide the "Values" being shown in the diagram while hovering - both on the Nodes as well as the Links. Im basically using the sankey chart to show...

View Article


Create a scatter plot between multiple variables

Create a scatter plot between flavanoids and phenols. Have the point color and shape reflect the wine origin.given:wineurl <- paste("https://archive.ics.uci.edu/ml/",...

View Article

How to show frequency or value or number on the Sankey diagram in R

I want to show every bar's number on the sankey like the image I uploaded,which represents the population of the relevant treatment pathways. I tried a lot of methods to add labels but it doesn't work...

View Article


Merging two dataframes on one matching variable and retaining only one value...

I have two dataframes I need to merge. The dataframes share all of the same columns. I am merging based on one shared variable, worker_ID. However, the other variables are often disjoint: one dataframe...

View Article

R: Include only business day observations in a data frame with observations...

I have a data frame with a date column and two columns of observations. I want to create a new data frame where only the observations that are from business days are included. I tried...

View Article


Image may be NSFW.
Clik here to view.

charts Treemap with ggplots and treemapify

I have simple data frame that I want to visualize with a treemap. I've made using ggplot and treemapify. It seems ok, but I am wondering how can I show both name and lab variables inside the treemap...

View Article

how to replace the coulomn of a factor variable with its dummy variable in R?

i have a variable name type in my data. it include all type of values like this: type='Hp','apple','unknown','nokia',... now i want to create a dummy variable that only show me which one is "Hp' and...

View Article

why I get "NA" as a result of min() and max() in my dataframe?

I have a dataframe(mydat) that has no any missing data.I use below commands:min(mydat) max(mydat) for achieving the minimum and maximum values of my dataframe but for both the above functions, I get...

View Article
Browsing all 204742 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>