Hello I am new to R and am trying to figure out how to extract specific categorical data from a list of data.
I have tried the subset command but cannot seem to get it to pull out more than one category in the data set. I have tried the list command and to concotanate the data but neither have worked. Any help would be greatly appreciated.
Here is one version of what I have tried:
EMFSubset<-subset(MSHData,Blast.genus.ID==list("Cadophora","Inocybe"), drop=FALSE)
You need to use %in% instead of ==
Related
Hello everyone and thanks a lot in advance for any help.
I'm not very good using Excel. I want to know if there is a simple way in which I can sort a small two-column data matrix following the order of a column that contains all the bird species in Colombia. I study birds and I usually do avifauna characterization studies. I've always had this problem of not being able to order efficiently using the taxonomic order of species. I have always done it by hand and it takes me a really long time.
This is the file with the example that ilustrates my problem: https://docs.google.com/spreadsheets/d/1089VD4ylJiW9Xw9xRFI0ehraAc_t-qSa/edit?usp=sharing&ouid=112790797352647984659&rtpof=true&sd=true
There are two worksheets in this file. One called "Species" and the other "Data". I need to know if it is possible to make Data array can be sorted following the Species column.
I have tried creating custom lists and the number of entries to create a certain order does not allow me to put more than 100. I have also tried using commands Sort and Sortby without any success.
Again, thanks a lot for any help.
Regrets.
On the Data worksheet, add a helper column:
C2: =MATCH(A2,Species!$A$1:$A$2000,0)
and fill down.
Then Sort by the helper column
So I need to select the 1. and the 4-15. row in an excel dataframe with df.iloc, but I just can't get the correct syntax, now I'm not even sure if its possible to do?
I tried: df.iloc[1,4:15:,:] and df.iloc[1:4:15:,:], I also tried to input the variables as a list of: [1,4,5....15] but neither work, could anyone help with the syntax of this?
Found nothing on google.
Combine list and slices with numpy's np.r_
df = df.iloc[np.r_[1,4:15], :]
I've tried to build a very simple model in order to learn using CombiTable in Open Modelica. I want to output the value of the table ( in particular y3 ).Can you help me please? I show you pictures with errors. Thank you very much. I'm using last version 1.12.0-64bit.
In line 3 you are setting columns=2:size(table,2). But variable table is nowhere defined in your script. You're probably thinking of table as an array, if that's the case, you have to define it.
If it's not the case and you're just testing modelica you can use a constant columns =2:N with N the number of columns in your table on the file.
I'm trying to create a network map in Python using NetworkX with labels to find protential connections between people. Currently I have a 1,316 x 1,316 matrix of 1's and 0's that represent if there is a connection or not. I have been able to import this data into pyhon using a dataframe. Screenshot of Dataframe This is a small screenshot of the python dataframe. You can see the column and row names are numbers but at the end of the list they turn into actual names. If I remove the names and make a grid of just 1's and 0's NetworkX will allow me to turn this into a connection graph but it is almost useless without the labels to know who is connected to who. When including the labels in dataframe and trying to run the code listed below I recieve an error.
Error
NetworkXError: Input is not a correct Pandas DataFrame.
Code
Network = pd.DataFrame.from_csv('H:\\Network.csv')
G1 = nx.to_networkx_graph(Network)
I will admit to being quite new at this so any and all help will be appreciated. If you have any advice on why I'm getting this error or a better way to go about this, I am open to suggestions.
Thanks for your help.
I had the same problem. What helped me to solve is to just transform the dataframe to a numpy array. (This only works if shape[0] == shape[1])
here is what I did:
Network = pd.DataFrame.from_csv('H:\\Network.csv')
G1 = nx.to_networkx_graph(Network.to_numpy())
This should work for you.
Im trying to make a multidimensional array from excel data. I have row 1, representing cone 1, with 5 columns of values. I largely am unsure what the best way to save my data would be, I think.
My first thought was to parse the data as a CSV using python csv module but that doesnt seem to easily represent the multirow aspect, although Im sure I will eventually figure out how to write the parsing for it.
only used Unity c# so kinda tough without good docs, thank you!
Might be best to create a struct with the columns that you need and an array that will hold all the rows. Loop through the csv file with simple Max Script readLine command and filterString with "," this will get you an array that you can populate an instance of the struct with and add the struct instance to the array. You could also just use nested arrays if you like.