While going through topic modelling with lda, I have to render the wordcloud output in the main panel of shiny,
The following lines define the worldcloud I have to render:
i <- 1
cloud.data <- sort(result$topics[i, ], decreasing = TRUE)[1:50]
wordcloud(names(cloud.data), freq = cloud.data, scale = c(4, 0.1), min.freq = 1,
rot.per = 0, random.order = FALSE)
I tried in renderPlot but it is giving me following error..
shiny::runApp('~/RProject/dynamic_UI')
Listening on http://127.0.0.1:3358
Error in if (grepl(tails, words[i])) ht <- ht + ht * 0.2 :
argument is of length zero
Warning in run(timeoutMs) : "min.freq" is not a graphical parameter
Warning in run(timeoutMs) : "min.freq" is not a graphical parameter
Then I corrected some parameters (for example, min.freqs for min.freq), getting now the following error:
shiny::runApp('~/RProject/dynamic_UI')
Listening on http://127.0.0.1:3358
Read 8265 items
Error in if (grepl(tails, words[i])) ht <- ht + ht * 0.2 :
argument is of length zero
Warning in run(timeoutMs) :
is.na() applied to non-(list or vector) of type 'NULL'
How could I render the wordcloud output in the main panel?
The name of my column did not match: should have been testdoc5$word but I had testdoc5$doc. Now it works!
Related
I try to run tis command
dtm <- CreateDtm(tokens$text,
doc_names = tokens$ID,
ngram_window = c(1, 2))
However I receive this error:
Error in seq.default(1, length(tokens), 5000) :
wrong sign in 'by' argument
In addition: Warning message:
In CreateDtm(tokens$text, doc_names = tokens$ID, ngram_window = c(1, :
No document names detected. Assigning 1:length(doc_vec) as names.
Any idea what I have to change in order to run it properly?
I had a similar problem to what posted here. To resolve the issue, followed the answer by #Jack Gisby there. Now a new error showed up:
Working on TCGA data , I am getting the same error (first error):
Error in `.rowNamesDF<-`(x, value = value) :
duplicate 'row.names' are not allowed
running duplicated() on each relevant field returned FALSE.
Her is the second error (just after trimming identifiers to not start with a common string like "TCGA-"):
Error in `[.data.frame`(df, neworder2) : undefined columns selected
> traceback()
5: stop("undefined columns selected")
4: `[.data.frame`(df, neworder2)
3: df[neworder2]
2: M3Creal(as.matrix(mydata), maxK = maxK, reps = repsreal, pItem = pItem,
pFeature = 1, clusterAlg = clusteralg, distance = distance,
title = "/home/christopher/Desktop/", des = des, lthick = lthick,
dotsize = dotsize, x1 = pacx1, x2 = pacx2, seed = seed, removeplots = removeplots,
silent = silent, fsize = fsize, method = method, objective = objective)
1: M3C(pro.vst, des = clin, removeplots = FALSE, iters = 25, objective = "PAC",
fsize = 8, lthick = 1, dotsize = 1.25)
I've added to an opened issue on the M3C GitHub.
I got the same error as Hamid Ghaedi while running M3C. I managed to track it down to the following line of code (line 476 on the M3C.R file):
df <- data.frame(m_matrix)
Many of my sample names (column names) started with a number and the data.frame() function added an "X" to the beginning of each name that started with a number ("1" becomes "X1"). This caused a mismatch with the names listed in neworder2.
To get around this problem, I changed all of my sample names to start with a letter and M3C is now running correctly.
Edit: This workaround can be easily applied by using the data.frame() function on your input dataset before running M3C.
I am using the eventstudies package in R and I am struggling to replicate the eventsudy function which is used as an example in the package as below:
# Event study without adjustment
es <- eventstudy(firm.returns = StockPriceReturns,
event.list = SplitDates,
event.window = 7,
type = "None",
to.remap = TRUE,
remap = "cumsum",
inference = TRUE,
inference.strategy = "bootstrap")
I use my own data for StockPriceReturns and SplitDates and even though I have tried to make them of the same format, type etc of those above I think this is where it is failing. The message I am getting is:
Error in phys2eventtime(z = returns$firm.returns, events =
event.list[i, : events$name should a character class. In addition:
Warning message: In is.na(events$name) : is.na() applied to
non-(list or vector) of type 'NULL'
Any help would be much appreciated.
I'm working the npreg example in the R np package documentation (by T. Hayfield, J. Racine), section 3.1 Univariate Regression.
library("np")
data("cps71")
model.par = lm(logwage~age + I(age^2),data=cps71)
summary(model.par)
#
attach(cps71)
bw = npregbw(logwage~age) # thislne not in example 3.1
model.np = npreg(logwage~age,regtype="ll", bwmethod="cv.aic",gradients="TRUE",
+ data=cps71)
This copied directly from the example, but the npreg call results in error message
*Rerun with Debug
Error in npreg.rbandwidth(txdat = txdat, tydat = tydat, bws = bws, ...) :
NAs in foreign function call (arg 15)
In addition: Warning message:
In npreg.rbandwidth(txdat = txdat, tydat = tydat, bws = bws, ...) :
NAs introduced by coercion*
The npreg R documentation indicates the first argument should be BW specificaion. I tried setting bws=1
model.np = npreg(bws=1,logwage~age,regtype="ll",
+ bwmethod="cv.aic",gradients="TRUE", data=cps71)
which gives the following error
*Error in toFrame(xdat) :
xdat must be a data frame, matrix, vector, or factor*
First time working with density estimation in R. Please suggest how to resolve these errors.
I`m using RStudio v 0.97. I want to get color scatterplot matrix, here is my code:
dt<- impact[c(3,4,7,8)]
dt.r <- cor(dt)
dt.color <- dmat.color(dt.r)
dt.order<- order.single(dt.r)
cpairs(dt, dt.order, panel.controls = dt.color, main= "Scatterplots")
But my output is black&white scatterplot and warning: "There were 50 or more warnings (use warnings() to see the first 50)"
How to fix this?
Read the help for cpairs:
Usage:
cpairs(data, order = NULL,
panel.colors = NULL, border.color = "grey70", show.points = TRUE, ...)
The parameter is panel.colors not panel.controls.
The warning is a clue - did you read the warning?
Warning messages:
1: In plot.window(...) : "panel.controls" is not a graphical parameter