r

How to plot x axis on top and y axis inverted in R Programming?

浪尽此生 提交于 2021-02-10 16:22:46
问题 In general when we do plotting, the plot has the x-axis on bottom (left to right) and y-axis on left (bottom to top). For example, In R-programming I have a code like this: t <- seq(0,1,0.2) # need t values in top x axis plot(t,t^2,type="l") # need t^2 values in inverted y-axis Now, if we want plot so that the x-axis is on top (left to right) and y-axis inverted (top to bottom). How can we achieve such a feat in R-programming? I searched following links in stackoverflow but they could not

Retaining unique identifiers (e.g., record id) when using tm functions - doesn't work with lot's of data?

元气小坏坏 提交于 2021-02-10 16:22:34
问题 I am working with unstructured text (Facebook) data, and am pre-processing it (e.g., stripping punctuation, removing stop words, stemming). I need to retain the record (i.e., Facebook post) ids while pre-processing. I have a solution that works on a subset of the data but fails with all the data (N = 127K posts). I have tried chunking the data, and that doesn't work either. I think it has something to do with me using a work-around, and relying on row names. For example, it appears to work

Silhouette plot is not working for more than 200 rows of data

旧巷老猫 提交于 2021-02-10 16:21:17
问题 I am trying to plot the silhouette for my k-means, using shiny. Below is the piece of code: dissE <- daisy(pima_diabetes_kmean[, c(input$models_to_consider)]) dE2 <- dissE ^ 2 sk2 <- silhouette(k.means.fit.knn()$cl, dE2) plot(sk2) It results in the following plot, where clusters are missing: However, if I change the code to use only 200 rows of data (or use window() ), it does work. But I do not want my results in a separate window, as I am using shiny. I want the results to be on the same

Silhouette plot is not working for more than 200 rows of data

╄→гoц情女王★ 提交于 2021-02-10 16:19:54
问题 I am trying to plot the silhouette for my k-means, using shiny. Below is the piece of code: dissE <- daisy(pima_diabetes_kmean[, c(input$models_to_consider)]) dE2 <- dissE ^ 2 sk2 <- silhouette(k.means.fit.knn()$cl, dE2) plot(sk2) It results in the following plot, where clusters are missing: However, if I change the code to use only 200 rows of data (or use window() ), it does work. But I do not want my results in a separate window, as I am using shiny. I want the results to be on the same

Geom_point putting dots at wrong values

大城市里の小女人 提交于 2021-02-10 16:17:44
问题 I have the following data, with which I'm trying to make a pretty simple line plot with dots. For some reason, the first three points of 2015 get placed with a value above 1600 when their value is around 1300. dput(data) structure(list(y_value = c(1143L, 1133L, 1148L, 1155L, 1149L, 1144L, 1181L, 1164L, 1178L, 1173L, 1176L, 1209L, 1284L, 1286L, 1283L, 1288L, 1362L, 1396L, 1599L, 1583L, 1606L, 1645L, 1653L, 1662L), Date = c("2014-1", "2014-2", "2014-3", "2014-4", "2014-5", "2014-6", "2014-7",

Query genes within regions

删除回忆录丶 提交于 2021-02-10 16:15:23
问题 I want to retrieve the genes that are present within a series of regions. Say, I have a bed file with query positions such like: 1 2665697 4665777 MIR201 1 10391435 12391516 MIR500 1 15106831 17106911 MIR122 1 23436535 25436616 MIR234 1 23436575 25436656 MIR488 I would like to get the genes that fall within those regions. I have tried using biomaRt , and bedtools intersect, but the output I get, is a list of genes corresponding to all the regions, not one by one, as the desired output I would

Converting a list of lists of strings to a data frame of numbers in R

蹲街弑〆低调 提交于 2021-02-10 16:02:33
问题 I have a list of lists of strings as follows: > ll [[1]] [1] "2" "1" [[2]] character(0) [[3]] [1] "1" [[4]] [1] "1" "8" The longest list is of length 2, and I want to build a data frame with 2 columns from this list. Bonus points for also converting each item in the list to a number or NA for character(0). I have tried using mapply() and data.frame to convert to a data frame and fill with NA's as follows. # Find length of each list element len = sapply(awards2, length) # Number of NAs to fill

partykit: Modify terminal node to include standard deviation and significance of regressors

北城余情 提交于 2021-02-10 16:01:31
问题 I would like to be able to personalize the plot that it is displayed to include standard deviation and statistical significance of the regressors after using the partykit::mob() function. The following code is from partykit documentation. library("partykit") if(require("mlbench")) { ## Pima Indians diabetes data data("PimaIndiansDiabetes", package = "mlbench") ## a simple basic fitting function (of type 1) for a logistic regression logit <- function(y, x, start = NULL, weights = NULL, offset

partykit: Modify terminal node to include standard deviation and significance of regressors

本秂侑毒 提交于 2021-02-10 16:00:32
问题 I would like to be able to personalize the plot that it is displayed to include standard deviation and statistical significance of the regressors after using the partykit::mob() function. The following code is from partykit documentation. library("partykit") if(require("mlbench")) { ## Pima Indians diabetes data data("PimaIndiansDiabetes", package = "mlbench") ## a simple basic fitting function (of type 1) for a logistic regression logit <- function(y, x, start = NULL, weights = NULL, offset

Installing rgdal - backdate rgdal version versus update gdal version, and how?

懵懂的女人 提交于 2021-02-10 15:59:59
问题 Two part question: 1) Like the person who asked this question (rgdal won't install on AWS RStudio AMI), I'm running into problems installing the rgdal package on R running on Ubuntu 16.04. The package wants GDAL 1.11.4 or later, and Synaptic Package manager is only offering GDAL 1.11.3. The solution offered on the above question is to install an older version of rgdal from the archive. On the other hand, the answer given to this older question (Trouble getting latest version of GDAL on ubuntu