Adjusted box plot in R - boxplot

I was wandering if someone knows a package for adjusted box plot.
I want for example to draw this boxplot(age~groupe+sexe+other_variables)
Thanks in advance,
Peter

Can't believe my answer was deleted. I don't know much about the stackoverflow rules, I don't know much about R (only studied r for 2 days), and I don't know much English even. I just happened to know this, and I was trying to help, since I've got lot help from the web. Let's try again.
I was wandering if someone knows a package for adjusted box plot.
Yes. There's a package named robustbase in r. And specifically the `adjbox()' fun in the package.
I want for example to draw this boxplot(age~groupe+sexe+other_variables)
Well, this is not a question. He meaned he wanted to do something, not he wanted examples, right (help my poor English)? Anyway you can draw an adjusted boxplot mainly like adjbox(age~groupe+sexe+other_variables)
Part of docstring of the func is as following:
adjbox(x, ..., range = 1.5, width = NULL, varwidth = FALSE,
notch = FALSE, outline = TRUE, names, plot = TRUE,
border = par("fg"), col = NULL, log = "",
pars = list(boxwex = 0.8, staplewex = 0.5, outwex = 0.5),
horizontal = FALSE, add = FALSE, at = NULL)
As for more details, you can try help(adjbox) in R, I think.
Here is some documents about the fuc arguments, and about the package.
Though I think "Yes, there's a func called adjbox in a package called robustbase in R can do that" was pretty enough to answer the question, especially for an R user, because R is well knowned as its good self documenting packages. And I don't think a long answer is gonna do more help. But still I'm trying to give a better answer. If somebody has a better answer, then answer. If somebody can modify my answer to be better, I'm fine with that Or if anybody can help me, I'm open to it, because I do actually need help on R and on English. But by just deleting the only answer isn't gonna help more. After all, I wasn't like asking for any voting, or demanding mine to be the best answer, or prevending others to answer it. Nor am I delivering wrong information.

There is a function named adjbox in the package robustbase.
As for the document for adjbox: http://svitsrv25.epfl.ch/R-doc/library/robustbase/html/adjbox.html
And the document for the robustbase: http://cran.r-project.org/web/packages/robustbase/robustbase.pdf

Related

GAMS: retrieve information from solution

GAMS: I think I have a pretty simple question, however I'm stuck and was wondering if someone could help here.
A simplified version of my model looks like this:
set(i,t) ;
parameter price
D;
variable p(i,t)
e(i,t);
equations
Equation1
obj.. C=sum((i,t), p(i,t)*price);
Model file /all/ ;
Solve file minimizing C using MIP ;
Display C.l;
p(i,t) and e(i,t) are related:
Equation1 .. e(i,t)=e=e(i,t-1)+p(i,t)*D
Now I want to retrieve information from the solution: lets say I want to know at what t e(i,t) has a certain value for example --> e(i,t)= x(i) or otherwise formulated e(i,t=TD)=x(i) find TD, where x(i) thus is depending on i. Does anyone know how I can write this in to my GAMs model? To be clear I do not want to change anything about my solution and the model I have runs; I just want to retrieve this information from the solution given.
So far I tried a couple of thing and nothing worked. I think that this must be simple, can anyone help? Thank you!
Try something like this:
set i /i1*i10/
t /t1*t10/;
variable e(i,t);
*some random dummy "solution"
e.l(i,t) = uniformInt(1,10);
set find5(i,t) 'find all combinations of i and t for which e.l=5';
find5(i,t)$(e.l(i,t)=5) = yes;
display e.l,find5;
Hope that helps,
Lutz

Gtk absolute/relative/ or "no" path (Windows)

Using Gtk+, we introduce some of the icons into the app via gtk_image_new_from_file(). We found that if the icon file is directly in the apps Dir, then it all works well with "no path", eg.
FString255 = "Icon_Charts.png"
IconImage_Ptr = gtk_image_new_from_file( Trim(FString255)//c_Null_Char )
However, when we tried to move the icons to a sub-Dir (what a surprise, called "Icons"), we could not get Gtk to recognise the png's. We tried every permutation we could think of using absolute and relative variations (e.g. with ".\" with "./", with "double slashes", with "C:.....\Icons..." etc.) ... no joy.
Does anybody know the syntax Gtk expects for relative path, e.g. something like:
FString255 = ".\Icons\Icon_Charts.png"
???
Or perhaps is there something "special" about gtk_image_new_from_file() and perhaps it can ONLY accept "no path" file-names?
We get the feeling it must be something super simple that we missed.
To avoid any non-obvious behavior you should always use absolute paths.
GLib provides the g_win32_get_package_installation_directory_of_module() function to allow getting the path of the current project (assuming standard directory layout). For example:
char *path, *package_dir;
package_dir = g_win32_get_package_installation_directory_of_module (NULL);
g_assert (package_dir != NULL);
path = g_build_filename (package_dir, "Icons", "Icon_Charts.png", NULL);
g_free (package_dir);
OK, sussed it, and we are feeling extremely stupid and embarrassed. As our OP suspected:
" We get the feeling it must be something super simple that we missed."
... well, it was :-(.
Before the "actual answer", TingPing's answer would be a possibility, if the real issue was not something else entirely. However, even then, if we were to go that route, we would use something like (keeping our submissions "Fortran-consistent" with the OP):
Temp_cPtr = g_get_current_dir_utf8 ()
!
If( c_Associated(Temp_cPtr) ) Then
!
!
n = c_StrLen( Temp_cPtr )
!
FString255Path = ""
!
Call C_F_String( Temp_cPtr, FString255Path(1:n) )
!
End if
!
!
FString255 = FString255Path(1:n)//"\Icons\Icon_Charts.png"
IconImage_Ptr(j) = gtk_image_new_from_file( Trim(FString255)//c_Null_Char )
or set "\Icons" as var and adjust the path variable at the outset, eg.
FString255Path = FString255Path(1:n)//"\Icons\"
FString255 = Trim(FString255Path)//"Icon_Charts.png"
... yes, we could have used Allocatable strings also, there is a reason why we used fixed len strings here.
In the event, the usual "simple" thing does actually work, for example, the desired relative path approach really is, as initially thought:
FString255 = ".\Icons\Icon_Charts.png"
IconImage_Ptr(j) = gtk_image_new_from_file( Trim(FString255)//c_Null_Char )
OK, now for the "actual answer", and our "monument to stupidity du jour"; in fact this Gtk app is quite large, with some parts of the front end created with Glade and "builder", while other parts are written explicitly in code. Some of the same icons are used by both the Glade/builder bits, as well as the explicit code bits. As it happens, we had used the correct (relative) path at the outset ... unfortunately, we looked for the results in a part of the GUI that is generated by the Glade/builder bits, and which of course have their own independent mechanism for loading icons (even if the same icons are re-used in the "code"), and so no amount of fiddling with the "code/paths" would make any difference there.
... this is rather a "bush-league" mistake on our part, and would feel better if the entire question/post was deleted ... but perhaps we should "honour our monument to stupidity" :-).
... our apologies for wasting anybody's time.

Matlab: Update an excel sheet

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.

Extraction of specific numbers

If a string has just a combination of 1(s) and 2(s) how do you extract all the 2(s).
I have tried this code below but does not work.
C=textscan(trigs,'%2d.',2);
Could someone point me in the right direction
You can obtain the position of all the 2's like this:
str = '11221212';
strfind(str,'2')
What? Just find the location of the elements in str with a '2' in it? I don't think you tried that hard, since there are at least a few ways I can see off the top of my head.
C = find(str == '2');
Or,
C = strfind(str,'2');
(There is also findstr, but that tool will apparently be obsolete/dropped at some point.)
Or,
C = regexp(str,'2')
Or,
C = find(ismember(str,'2'));
I'll bet there are lots more ways too. Take a glance through the output of this:
help strfun

rtod() not working as expected. Possible misuse?

I am using DDMathParser in my application but I do not understand how to use the function rtod(). I have tried multiple equations but it does not seem to be working.
Some equations do work ex. rtod(acos(0)). But others are not rtod(sin(50)).
Here is an example of the test I did:
> rtod(acos(0))
rtod(acos(0)) = 90
> rtod(sin(50))
rtod(sin(50)) = -15.03297176759753
>
Is it the fact that I am misusing it? I'm not quite sure. But i'm pretty sure that it works someway, for I downloaded an application with DDMathParser built in and there's works just fine.
Hope someone can help!
sin(50) is not the same as sin(50 degrees) because it's decimal (values go up to tenths).
You're feeding in decimals which the trigonometric functions see as radians.
sin(rtod(50))
Try it like that.
rtod(50) = 0.872664626 radians
sin(0.872664626) = 0.766044443