Add sample names to s.class - label

So I'm trying to add sample names to my PCA s.class. Someone here (on another question) suggested adding text() to it, but I can't seem to figure out how to align the two.
Here is my code:
s.class(pca1$li, fac = beardata$pop, xax=1, yax=2)
add.scatter.eig(pca1$eig[1:20], 3,1,2, pos="bottomright", inset=.01, ratio=.18)
first code image
s.class(pca1$li, fac = beardata$pop)
text(pca1$li,labels=indNames(beardata),cex=0.7)
add.scatter.eig(pca1$eig[1:20], 3,1,2, pos="bottomright", inset=.01, ratio=.18)
This is what I get with added text()
Thank you for any help, I'm quite new at this so I hope this has easy solution.

Related

OpenNlp Case Insensitive Location Finder

I want to get the name of the locations mentioned in a sentence. Everything works fine untill a location name is found with small starting letter.
So is there any way to solve this problem? Do I need to train my own model file?
Any help will be appreciated.
you'll need to make your own model file for these type of things, which is tedious.
A simple solution would be, add some code to make the first letter capital of every token in your sentence before finding the location.
something like this,mentioned here:
String str = "java";
String cap = str.substring(0, 1).toUpperCase() + str.substring(1);
hope this helps!

How do I copy large ranges between workbooks efficiently?

i'm writing a copy paste function for a fairly large dataset to be copied from one workbook to a specific sheet in another. I have written the bellow code, in the hope that it will copy paste as efficiently as possible, however during debugging the code was shown not to be working at all, it doesnt copy or paste anything and I dont understand why, does anyone have any ideas / solutions? thanks in advance
Windows("TempResults.xlsm").Activate
numofrows = ActiveSheet.UsedRange.Rows.Count
Workbooks("TempResults.xlsm").Sheets("Sheet1").Range("A2", "AE" & CStr(numofrows)).Copy Destination:=Workbooks("Excel Results Extractor V2.xlsm").Sheets("Gate_Results").Range("A1").End(xlDown).Offset(1, 0)
I guess this is what you want
Windows("TempResults.xlsm").Activate
numofrows = ActiveSheet.UsedRange.Rows.Count
Workbooks("TempResults.xlsm").Sheets("Sheet1").Range("A2", "AE" & CStr(numofrows)).Copy Destination:=Workbooks("Excel Results Extractor V2.xlsm").Sheets("Gate_Results").Range("A1")
Regarding the efficiency concern expressed in your question: you can try an alternative approach, like the following:
Workbooks("Excel Results Extractor V2.xlsm").Sheets("Gate_Results").Range("A1").Value = Workbooks("TempResults.xlsm").Sheets("Sheet1").Range("A1").Value
Try to see how it works, then modify the range correspondingly to your case.
Hope this will help. Regards,

Generate code in code_128 format from another code

I have a list of the following codes and their corresponding codes in format code_128. I want to given a string, be able to generate the corresponging code in CODE_128 format. Based on this list, how could I generate a code_128 number to the string A4Y9387VY34, for example?
code code in code_128
A4Y9387VY34 ????
ADN38Y644YT7 9611019020018632869509
AXCW99QYTD34 9622019021500078083444
A9YQC44W9J3K 9611083009710754539701
AT8V7T3G3874 9622083021255845940154
A7K444N4FKB8 9622083033510467186874
AYCHFW448HTQ 9611005019246067403120
AY63CWBMTDCC 9622005028182439033426
ANY7TF46NGQ3 9622005031345848081170
AYY48TBVQ3FH 9611200003793988696055
AT8Q4CF4DQ9Q 9611200021606968867090
A764WYQFJWTT 9622200022706968919275
AC649ND7N8B6 9622148007265209832185
A4VDPTJ99YN4 9611148013412173923039
AHDYK498BD6T 9622148021309216149530
A4YYYNY7C3DJ 9611017021934363499071
AYG6XWVCCQ89 9622017031009914238743
A68YJHGQKCCM 9622017031138587166053
APMB7XG9XQC9 9611021011608391750002
AGP8C44Y8VYK 9622021021608111646113
A7C68B9T69XB 9622021021958603678086
AJYYWKR6BDGN 9611010022528724015883
AKMNVXDT9PYN 9622010027475034102229
AXPXMK9QMDFD 9622010031475028243694
I read a lot about it, but I didn't come to any solution. Thanks in advance!!
Well, this is a pretty open question, I will give you my suggestions:
If it is a finite list, you can use a Hash or a Dictionary, where
the keys are the Codes and map them to the corresponding value, in
your case, Code_128
Some scanners have software installed that allow you to change what
has been read to a new value, format it, etc.
If you need a bigger insight please, give us more detail about the environment you are using.
Hope that helps,
I decided to create a new answer because now I get your point. Well, if you are talking about a GS1-128 Code (please see www.gs1.org) please do not start without visiting Wikipedia info about it. as you can see, there is a thorough explanation about how to work with that type of code. That code is composed by several application identifiers followed by their corresponding values. There is a better way of encoding them by using special characters as parenthesis. Here is other info that may help you.
Hope it helps,

using xpath in selenium.get.Text and selenium.click

I have Адреса магазинов on page and want to store text, then click on this link and verify that the page where am I going to contains this text in headers. So I tried to find element by xpath, and selenium.getText get the right result, but selenium.click goes to another link. Where have I made a mistake? Thanks in advance!
String m_1 = selenium.getText("xpath=html/body/div[3]/div[2]/div[1]/h4[1]");
selenium.click("xpath=html/body/div[3]/div[2]/div[1]/h4[1]");
selenium.waitForPageToLoad("30000");
assertTrue(selenium.getText("css=h3").contains(m_1));
page:http://www.svyaznoy.ru/map/
Resume:
using xpath=//descendant::a[#href='/address_shops/'][2] or css=div.deff_one_column a[href='/address_shops/'] get right results
using xpath=//a[#href='/address_shops/'] - Element is not currently visible
xpath=//a[#href='/address_shops/'][2] - Element not found
There is a missing slash at the beginning of the expression. I am kind of surprised this got through at all - the first slash means "begin at root node".
Also, it is better to select the <a> element instead of the <h>. Sometimes it works, sometimes is misclicks, sometimes the click doesn't do anything at all. Try to be as concrete as you can be.
Try this one.
String m1 = selenium.getText("xpath=/html/body/div[3]/div[2]/div/h4/a");
selenium.click("xpath=/html/body/div[3]/div[2]/div/h4/a");
selenium.waitForPageToLoad("30000");
// your variable is named m1, but m_1 was used here
assertTrue(selenium.getText("css=h3").contains(m1));
By the way, there are even better XPath expressions you could use. See the documentation, it really is helpful. Just an example, this would work, too, and is much easier to write and read:
String m1 = selenium.getText("xpath=//a[#href='/address_shops/']");
selenium.click("xpath=//a[#href='/address_shops/']");
Sorry, didn't notice page link. Css for second link can be something like that css=div.deff_one_column a[href='/address_shops/']

Descendent-or-self in InfoPath

I want to use XPath code in an InfoPath form to sum the data in field12 when field11 is equal to IT. I tried using the following code, but it doesn't work.
number(sum(/descendant-or-self::node()/my:group12[my:field11 = "IT;"]/my:field12))
I suspect this has to do with the multilayering of groups, as shown below. Does anyone know the code that would allow me to get to the data in group12? Thanks in advance for your help.
myfields>group9>group10>group11>group12>field11 field12
Genipro
Looks like:
number(sum(/descendant-or-self::my:group12[my:field11 = 'IT;']/my:field12))
could be right.
decendant-or-self should not be necissary in this case (unless you need the expression to work even if group12 is moved).
This should work fine:
sum(/my:myfields/my:group9/my:group10/my:group11/my:group12[contains(my:field11,'IT')]/my:field12)
It doesn't matter if any of the other groups are repeating either. All group12's will be checked.

Resources