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…

Continue Reading read.GenBank function – RDocumentation

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,…

Continue Reading element_textbox function – RDocumentation

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…

Continue Reading restart function – RDocumentation

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…

Continue Reading scale_fill_viridis function – RDocumentation

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…

Continue Reading getRs function – RDocumentation

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”,…

Continue Reading geom_qq_line function – RDocumentation

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…

Continue Reading annotate function – RDocumentation

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 +…

Continue Reading coord_polar function – RDocumentation

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…

Continue Reading r shin :: testserver cat messages results

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)…

Continue Reading aes function – RDocumentation

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” =…

Continue Reading scale_x_discrete function – RDocumentation

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 &…

Continue Reading scale_color_d3 function – RDocumentation

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,…

Continue Reading theme_nothing function – RDocumentation

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…

Continue Reading ranef function – RDocumentation

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”,…

Continue Reading scale_colour_discrete function – RDocumentation

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’…

Continue Reading BiocManager package – RDocumentation

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,…

Continue Reading ymd_hms function – RDocumentation

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…

Continue Reading labs function – RDocumentation

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. #…

Continue Reading guides function – RDocumentation

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 ~…

Continue Reading qplot function – RDocumentation

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…

Continue Reading RSQLite package – RDocumentation

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:…

Continue Reading ggplot2 package – RDocumentation

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…

Continue Reading geom_path function – RDocumentation

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…

Continue Reading prepare.ggplot.shap.data function – RDocumentation

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…

Continue Reading How to add gradient to ridgeplot? – ggplot2

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…

Continue Reading labkey.experiment.saveRuns function – RDocumentation

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,…

Continue Reading chromoMap function – RDocumentation

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)),…

Continue Reading ggplot2loon function – RDocumentation

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 =…

Continue Reading multiRegression function – RDocumentation

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…

Continue Reading labkey.provenance.stopRecording function – RDocumentation

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…

Continue Reading stri_trans_nfc function – RDocumentation

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…

Continue Reading sqliteCopyDatabase function – RDocumentation

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…

Continue Reading h2o.explain function – RDocumentation

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 =…

Continue Reading RunPCA function – RDocumentation

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 =…

Continue Reading Adjust the legends distance to the x-axis?

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…

Continue Reading labkey.pipeline.getProtocols function – RDocumentation

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…

Continue Reading labkey.webdav.delete function – RDocumentation