Tag: RDocumentation
read.GenBank function – RDocumentation
The function uses the site www.ncbi.nlm.nih.gov/ from where the sequences are retrieved. If species.names = TRUE, the returned list has an attribute “species” containing the names of the species taken from the field “ORGANISM” in GenBank. Since ape 3.6, this function retrieves the sequences in FASTA format: this is more…
element_textbox function – RDocumentation
Usage element_textbox( family = NULL, face = NULL, size = NULL, colour = NULL, fill = NULL, box.colour = NULL, linetype = NULL, linewidth = NULL, hjust = NULL, vjust = NULL, halign = NULL, valign = NULL, lineheight = NULL, margin = NULL, padding = NULL, width = NULL,…
restart function – RDocumentation
It is not possible to restart an R session running in RGui on Microsoft Windows using this function. It is not possible to restart an R session in the RStudio Console using this function. However, it does work when running R in the RStudio Terminal. RStudio provides rstudioapi::restartSession() which will…
scale_fill_viridis function – RDocumentation
library(ggplot2) # Ripped from the pages of ggplot2 p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point(size = 4, aes(colour = factor(cyl))) + scale_color_viridis(discrete = TRUE) + theme_bw() # Ripped from the pages of ggplot2 dsub <- subset(diamonds, x > 5 & x < 6 & y > 5 & y…
getRs function – RDocumentation
if (FALSE) { getRs() # list available scripts scripts <- getRs() # likewise, but store in an object that can easily # be viewed on demand in RStudio getRs(‘introda.r’) # download introda.r and put in script editor getRs(cats=TRUE) # list available major and minor categories categories <- getRs(cats=TRUE) # likewise…
geom_qq_line function – RDocumentation
Usage geom_qq_line( mapping = NULL, data = NULL, geom = “path”, position = “identity”, …, distribution = stats::qnorm, dparams = list(), line.p = c(0.25, 0.75), fullrange = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )stat_qq_line( mapping = NULL, data = NULL, geom = “path”, position = “identity”,…
annotate function – RDocumentation
p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() p + annotate(“text”, x = 4, y = 25, label = “Some text”) p + annotate(“text”, x = 2:5, y = 25, label = “Some text”) p + annotate(“rect”, xmin = 3, xmax = 4.2, ymin = 12, ymax…
coord_polar function – RDocumentation
# NOTE: Use these plots with caution – polar coordinates has # major perceptual problems. The main point of these examples is # to demonstrate how these common plots can be described in the # grammar. Use with EXTREME caution. #’ # A pie chart = stacked bar chart +…
r shin :: testserver cat messages results
Summary Reactive testing for Shiny server functions and modules can be used to test the reactive interactions in Shiny applications. 1 This includes interactions defined in the server function of applications and in modules. 1 According to See more results on Neeva Summaries from the best pages on the web…
aes function – RDocumentation
aes(x = mpg, y = wt) aes(mpg, wt) # You can also map aesthetics to functions of variables aes(x = mpg ^ 2, y = wt / cyl) # Or to constants aes(x = 1, colour = “smooth”) # Aesthetic names are automatically standardised aes(col = x) aes(fg = x)…
scale_x_discrete function – RDocumentation
ggplot(diamonds, aes(cut)) + geom_bar() # \donttest{ # The discrete position scale is added automatically whenever you # have a discrete position. (d <- ggplot(subset(diamonds, carat > 1), aes(cut, clarity)) + geom_jitter()) d + scale_x_discrete(“Cut”) d + scale_x_discrete( “Cut”, labels = c( “Fair” = “F”, “Good” = “G”, “Very Good” =…
scale_color_d3 function – RDocumentation
library(“ggplot2”) data(“diamonds”) p1 <- ggplot( subset(diamonds, carat >= 2.2), aes(x = table, y = price, colour = cut) ) + geom_point(alpha = 0.7) + geom_smooth(method = “loess”, alpha = 0.1, size = 1, span = 1) + theme_bw() p2 <- ggplot( subset(diamonds, carat > 2.2 & depth > 55 &…
theme_nothing function – RDocumentation
# no legend example n <- 50 df <- expand.grid(x = 1:n,y = 1:n)[sample(n^2,.5*n^2),] p <- ggplot(df, aes(x, y)) + geom_raster() p p + theme_nothing() p + theme_nothing(legend = TRUE) # no difference p + scale_x_continuous(expand = c(0,0)) + scale_y_continuous(expand = c(0,0)) + theme_nothing() # legend example df$class <- factor(sample(0:1,…
ranef function – RDocumentation
library(lattice) ## for dotplot, qqmath fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy) fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy) fm3 <- lmer(diameter ~ (1|plate) + (1|sample), Penicillin) ranef(fm1) str(rr1 <- ranef(fm1)) dotplot(rr1) ## default qqmath(rr1) ## specify free scales in order to make Day effects more…
scale_colour_discrete function – RDocumentation
# Template function for creating densities grouped by a variable cty_by_var <- function(var) { ggplot(mpg, aes(cty, colour = factor({{var}}), fill = factor({{var}}))) + geom_density(alpha = 0.2) } # The default, scale_fill_hue(), is not colour-blind safe cty_by_var(class) # (Temporarily) set the default to Okabe-Ito (which is colour-blind safe) okabe <- c(“#E69F00”,…
BiocManager package – RDocumentation
Overview The BiocManager package, as the modern successor package to BiocInstaller, allows users to install and manage packages from the Bioconductor project. Bioconductor focuses on the statistical analysis and comprehension of high-throughput genomic data. Current Bioconductor packages are available on a ‘release’ version intended for every-day use, and a ‘devel’…
ymd_hms function – RDocumentation
ymd_hms( …, quiet = FALSE, tz = “UTC”, locale = Sys.getlocale(“LC_TIME”), truncated = 0 ) ymd_hm( …, quiet = FALSE, tz = “UTC”, locale = Sys.getlocale(“LC_TIME”), truncated = 0 ) ymd_h( …, quiet = FALSE, tz = “UTC”, locale = Sys.getlocale(“LC_TIME”), truncated = 0 ) dmy_hms( …, quiet = FALSE,…
labs function – RDocumentation
p <- ggplot(mtcars, aes(mpg, wt, colour = cyl)) + geom_point() p + labs(colour = “Cylinders”) p + labs(x = “New x label”) # The plot title appears at the top-left, with the subtitle # display in smaller text underneath it p + labs(title = “New plot title”) p + labs(title…
guides function – RDocumentation
# \donttest{ # ggplot object dat <- data.frame(x = 1:5, y = 1:5, p = 1:5, q = factor(1:5), r = factor(1:5)) p <- ggplot(dat, aes(x, y, colour = p, size = q, shape = r)) + geom_point() # without guide specification p # Show colorbar guide for colour. #…
qplot function – RDocumentation
# Use data from data.frame qplot(mpg, wt, data = mtcars) qplot(mpg, wt, data = mtcars, colour = cyl) qplot(mpg, wt, data = mtcars, size = cyl) qplot(mpg, wt, data = mtcars, facets = vs ~ am) # \donttest{ set.seed(1) qplot(1:10, rnorm(10), colour = runif(10)) qplot(1:10, letters[1:10]) mod <- lm(mpg ~…
RSQLite package – RDocumentation
Embeds the SQLite database engine in R, providing a DBI-compliant interface. SQLite is a public-domain, single-user, very light-weight database engine that implements a decent subset of the SQL 92 standard, including the core table creation, updating, insertion, and selection operations, plus transaction management. You can install the latest released version…
ggplot2 package – RDocumentation
Aesthetics: grouping Given a character vector, create a set of identity mappings Automatic aesthetic mapping Modify properties of an element in a theme object Absolute grob Differentiation related aesthetics: linetype, size, shape Construct aesthetic mappings Colour related aesthetics: colour, fill, and alpha Control aesthetic evaluation Define aesthetic mappings programmatically Annotation:…
geom_path function – RDocumentation
# geom_line() is suitable for time series ggplot(economics, aes(date, unemploy)) + geom_line() ggplot(economics_long, aes(date, value01, colour = variable)) + geom_line() # You can get a timeseries that run vertically by setting the orientation ggplot(economics, aes(unemploy, date)) + geom_line(orientation = “y”) # geom_step() is useful when you want to highlight exactly…
prepare.ggplot.shap.data function – RDocumentation
Description Conforms to data format required for ggplot functions. Usage prepare.ggplot.shap.data(data_list, normalize = FALSE) Value A data.table containing the observation ID, the feature name, the feature value (normalized if specified), and the SHAP contribution value. Arguments data_list List containing ‘data’ and ‘shap_contrib’ returned by xgb.shap.data(). normalize Whether to standardize feature…
How to add gradient to ridgeplot? – ggplot2
2 January 2023 class #End result is same, only equation to get the result is a little different #ggplot(data = <DATA>) + <GEOM_FUNCTION>(mapping=aes(<MAPPING>)) #ggplot(data = <DATA>, mapping = aes(<MAPPINGS>)) + <GEOM_FUNCTION>() #ggplot(<DATA>, aes(<MAPPINGS>)) + <GEOM_FUNCTION>() #ggplot(<DATA>) + <GEOM_FUNCTION>(aes(<MAPPINGS)) #how to change library you are working in library(dplyr) #mpg dataset is…
labkey.experiment.saveRuns function – RDocumentation
Examples # NOT RUN { library(Rlabkey) ## example with materialInputs and materialOutputs m1 <- labkey.experiment.createMaterial( list(name = “87444063.2604.626”), sampleSetName = “Study Specimens”) m2 <- labkey.experiment.createMaterial( list(name = “87444063.2604.625”), sampleSetName = “Study Specimens”) run <- labkey.experiment.createRun( list(name=”new run”), materialInputs = m1, materialOutputs = m2) labkey.experiment.saveRuns(baseUrl=”http://labkey/”, folderPath=”home”, protocolName=labkey.experiment.SAMPLE_DERIVATION_PROTOCOL, runList=run) # } Run…
chromoMap function – RDocumentation
Usage chromoMap( ch.files, data.files, title = c(), ch_gap = 5, ploidy = 1, top_margin = 25, left_margin = 50, chr_width = 15, chr_length = 4, chr_color = c(“black”), data_based_color_map = FALSE, segment_annotation = FALSE, lg_x = 0, lg_y = 0, data_type = c(“numeric”, “categorical”), labels = FALSE, canvas_width = NULL,…
ggplot2loon function – RDocumentation
Examples # NOT RUN { if(interactive()) { p <- ggplot(mtcars, aes(wt, mpg)) + geom_point() g <- ggplot2loon(p) p1 <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg, colour = factor(gear))) + facet_wrap(~am) g1 <- ggplot2loon(p1) # } # NOT RUN { df <- data.frame( x = rnorm(120, c(0, 2, 4)),…
multiRegression function – RDocumentation
Examples # NOT RUN { seed = 1234 N = 100 # sample size Ng = 5 # gene number Nk = 5 * 3 # eQTL number Ns = 1 # sparse ratio sigma2 = 0.01 # sigma2 set.seed(seed) data = randomFSSEMdata(n = N, p = Ng, k =…
labkey.provenance.stopRecording function – RDocumentation
Examples Run in Workspace # NOT RUN { library(Rlabkey) ## object inputs (from an assay run) and material inputs ## oi <- labkey.selectRows(baseUrl=”https://labkey.org/labkey/”, folderPath = “Provenance”, schemaName=”assay.General.titer”, queryName=”Data”, colSelect= c(“LSID”), colFilter=makeFilter(c(“Run/RowId”,”EQUAL”,”253″))) mi <- data.frame(lsid=c(“urn:lsid:labkey.com:Sample.251.MySamples:sample1″, “urn:lsid:labkey.com:Sample.251.MySamples:sample2″)) p <- labkey.provenance.createProvenanceParams(name=”step1″, description=”initial step”, objectInputs=oi[[“LSID”]], materialInputs=mi) r <- labkey.provenance.startRecording(baseUrl=”https://labkey.org/labkey/”, folderPath = “Provenance”, provenanceParams=p) run…
stri_trans_nfc function – RDocumentation
Unicode Normalization Forms are formally defined normalizations of Unicode strings which, e.g., make possible to determine whether any two strings are equivalent. Essentially, the Unicode Normalization Algorithm puts all combining marks in a specified order, and uses rules for decomposition and composition to transform each string into one of the…
sqliteCopyDatabase function – RDocumentation
Description Copies a database connection to a file or to another database connection. It can be used to save an in-memory database (created using dbname = “:memory:” or dbname = “file::memory:”) to a file or to create an in-memory database a copy of another database. Usage sqliteCopyDatabase(from, to) Arguments from…
h2o.explain function – RDocumentation
Description The H2O Explainability Interface is a convenient wrapper to a number of explainabilty methods and visualizations in H2O. The function can be applied to a single model or group of models and returns a list of explanations, which are individual units of explanation such as a partial dependence plot…
RunPCA function – RDocumentation
RunPCA(object, …) # S3 method for default RunPCA( object, assay = NULL, npcs = 50, rev.pca = FALSE, weight.by.var = TRUE, verbose = TRUE, ndims.print = 1:5, nfeatures.print = 30, reduction.key = “PC_”, seed.use = 42, approx = TRUE, … ) # S3 method for Assay RunPCA( object, assay =…
Adjust the legends distance to the x-axis?
ggplot2: Adjust the legends distance to the x-axis? I want to shrink the legends distance to the x-axis, but I can’t find a way to do it. Is it possible? Example code: library(ggplot2) ggplot(mtcars, aes(x = gear, y = mpg, fill = gear)) + geom_bar(stat = “identity”) + theme(legend.position =…
labkey.pipeline.getProtocols function – RDocumentation
Description Gets the protocols that have been saved for a particular pipeline. Usage labkey.pipeline.getProtocols(baseUrl=NULL, folderPath, taskId, path, includeWorkbooks = FALSE) Arguments baseUrl a string specifying the baseUrl for the LabKey server folderPath a string specifying the folderPath taskId a string identifier for the pipeline path a string for the relative…
labkey.webdav.delete function – RDocumentation
Description This will delete the supplied file or folder under the specified LabKey Server project using WebDAV. Usage labkey.webdav.delete( baseUrl=NULL, folderPath, remoteFilePath, fileSet=”@files” ) Arguments baseUrl a string specifying the baseUrl for the labkey server folderPath a string specifying the folderPath remoteFilePath the path to delete, relative to the LabKey…