I am using the tm and wordcloud packages in R 2.15.1.
I am trying to make a word cloud from a DTM. Here is the code:
library(wordcloud)
thedtmsparse = inspect(sparse)
trymatrix = t(thedtmsparse)
colnames(trymatrix) = c()
comparison.cloud(trymatrix, max.words=15, random.order=FALSE)
I get the following error from the last command:
Error in strwidth(words[i], cex = size[i], ...) : invalid 'cex' value
I have used the same code on another DTM where it worked fine and I got the word cloud.
Can somebody tell me a fix for the error?
Ravi
You haven't provided reproducible code (probably a big reason no one answered your question), so I can only venture to guess what the problem might be.
I faced this same error, so I'll share my experience. The problem was I had NA's instead of 0's in my term document matrix. Simply fixing that fixed that problem.
Related
I'm coding an RL environment using Matlab and simulink and I'm following the code set out in the following example from mathworks (https://uk.mathworks.com/help/reinforcement-learning/ug/create-simulink-environment-and-train-agent.html)
However for some reason when I'm defining my 'featureInputLayer' I keep getting an error stating that there is an invalid argument at position 1. I'm not certain on what this means, I've seen a few other questions asked here on similar topics but haven't been able to find an answer.
Here's the code where I'm getting an error (the featureInputLayer of StatePath):
statePath = [
featureInputLayer(numObservations,'Normalization','none','Name','State')
fullyConnectedLayer(50,'Name','CriticStateFC1')
reluLayer('Name','CriticRelu1')
fullyConnectedLayer(25,'Name','CriticStateFC2')];
actionPath = [
featureInputLayer(numActions,'Normalization','none','Name','Action')
fullyConnectedLayer(25,'Name','CriticActionFC1')];
commonPath = [
additionLayer(2,'Name','add')
reluLayer('Name','CriticCommonRelu')
fullyConnectedLayer(1,'Name','CriticOutput')];
Any help would be greatly appreciated :D
I am trying to run below code to read all csv files available at location C:/q/BitCoin/Input.Getting an error and dont know what the solution is?csv files are standard ones with three fields.
raze{[x]
inputdir:`:C:/q/BitCoin/Input;
filelist1:key inputdir;
filelist2:` sv' inputdir,'filelist1;
filelist3:string filelist2;
r:flip`Time`Qty`Price!("ZFF";",")0:x;
select from r
} each `$filelist3
Hard coding the file names and running below code works but I don't want to hard code
raze {[x]
r:flip`Time`Qty`Price!("ZFF";",")0:x;
select from r
} each (`$"C:/q/BitCoin/Input/bitbayPLN.csv";`$"C:/q/BitCoin/Input/anxhkAUD.csv")
Getting below error
An error occurred during execution of the query.
The server sent the response:
filelist3
Can someone help with issue?
The reason that you are receiving the error 'filelist3 is because filelist3 is defined in the lambda and outside of the lambda it is not recognised or defined. There are various ways to overcome this as outlined below.
Firstly you can essentially take all of the defined work done on the inside of the lambda and put it on the right side of the each.
raze{[x] r:flip`Time`Qty`Price!("ZFF";",")0:x; select from r
} each `$(string (` sv' `:C:/q/BitCoin/Input,'(key `:C:/q/BitCoin/Input)))
Or if you wanted to you could create a function which will generate filelist3 for you and use that on the right hand side of the each also.
f:{[inputdir] filelist1:key inputdir; filelist2:` sv' inputdir,'filelist1; filelist3:string filelist2; filelist3}
raze{[x] r:flip`Time`Qty`Price!("ZFF";",")0:x; select from r
} each `$f[`:C:/q/BitCoin/Input]
I hope this helps.
Many thanks,
Joel
My question is a little bit stupid, but still, I would like someone who can help me if he/she face the same problem as me.
I copy the codes directly from MATLAB mathwork:
anonrosen = #(x)(100*(x(2) - x(1)^2)^2 + (1-x(1))^2);
opts = optimoptions(#fmincon,'Algorithm','interior-point');
problem = createOptimProblem('fmincon','x0',randn(2,1),...
'objective',anonrosen,'lb',[-2;-2],'ub',[2;2],'options',opts);
However, it gives the following error message:
Undefined function 'createOptimProblem' for input arguments of type 'optim.options.Fmincon'.
createOptimProblem should be a built-in function, but with the presence of the error message, I wonder if I need to declare sth before using createOptimProblem, what should I do?
I am using R2013a version
How do I run a query using a value from a textbox from a form I have? I know that there is another post here at Stackoverflow dealing with this issue but I found it to be insufficient for my needs.
I formated my textbox into Medium Date format with its default value being =Date(). However, when I pick up a date and open my report I get this error:
Runtime error 3071: Expression Too Complex
My where clause is this
WHERE
(
(AllInfo.DateOpened >= CDate([Forms]![Main Form]![WindowPrintOptions]![CustomizedReport]!txtDateOpenedFrom.Value))
)
and I am sure it is this code piece that is throwing the problem since when I take it out of the query the error message simply disappears.
Any ideas?
Try with:
(AllInfo.DateOpened >= DateValue([Forms]![Main Form]![WindowPrintOptions].[Form]!txtDateOpenedFrom))
)
Folks,
I got the problem. It was the "AllInfo" alias. It wasn't applicable at that escope inside the query. By changing the proper things, it was enough to write:
[Forms]![Main Form]![WindowPrintOptions]![CustomizedReport]!txtDateOpenedFrom.Value
Issue solved. Thank you all!
I am using Matlab to read a workbook with a bunch of sheets in it.
I do some calculation and have to update one particular column in one sheet. I tried using xlswrite after xlsread, it does not work.
So, my code looks something like:
[~,~,Data] = xlsread('MyFile.xlsx', 'MySheet');
Data(2:end-1,5) = Data(2:end-1,5) + 1.5; %Random operation for illustration only
ret = xlswrite('MyFile.xlsx',Data,'MySheet');
But ret is 0. So, I am not able to achieve replacement process. Can you please help.
Thanks
Based on my own comment:
Please use the second output argument as well an check what message you get:
[status,message] = xlswrite(filename,A,sheet)
Hopefully that is sufficient to find the cause, please let us know if that's the case.
Apparently it was indeed sufficient for the asker.