Import custom partition into Gephi - gephi

I was wondering if gephi supports importing a cluster file that has the community assignment of each node in a graph on a separate line (similar to the Pajek .clu format)? I am looking for a way to color the nodes belonging to the same community. In igraph (for R), I can import this file and set the vertex color attributes based on it. Was wondering if gephi had a similar feature?
I saw this answer here from over 5 years ago saying that it wasn't possible, was wondering if that had changed now?
Thanks!

The .clu file contains one line per node with the cluster number at least the example I see here. Gephi cannot import it directly but you can trick it to obtain the same result. Here are the steps I propose:
Import your .net file with Gephi
Go to Data Laboratory and sort your nodes according to the Id column, by clicking on the column name
Create a new column called Cluster by pressing Add column the bottom of the screen. The default String type will do
Click Export table, select only the fields Id and Cluster, and export the file somewhere
Open the CSV file with e.g. Excel or LibreOffice
Open your .clu file with a text editor, even Notepad will do
Copy all the numbers in the file and paste them in the Cluster column of your CSV. Save your CSV
Import the CSV back into Gephi, by clicking Import Spreadsheet and press ok through the next steps.
At the end you should see your Cluster values having the same values as in the .clu file!
Make sure that the same field delimiter is used throughout in steps 4. and 8. I would suggest to use ; as Excel directly understands it.
You are welcome to report back if you are still having problems

Related

Google Sheet gviz csv export - two column labels not exporting

I'm trying to export this Sheet to a csv for use in a webmap using this link:
https://docs.google.com/spreadsheets/d/1XQnp7RK-Ddq4wCjpHjmcnVEKood1U08kIfRGr8sDRoU/gviz/tq?tqx=out:csv&sheet=Sheet1
It works well, except that two of the column headers (lat, long) are not exporting and the column labels in the csv are blank. I tried to change the format of the cell from Automatic to Plain text, but that didn't fix it.
Findings
It seems this is an issue with gviz api as there's an ongoing Google Issue tracker report about it. You may want to click the star icon on the top left of issue report page to indicate that your are also affected by this issue.
UPDATE
As an alternative solution, you may try this way as this will export the same csv file:
https://docs.google.com/spreadsheets/d/1XQnp7RK-Ddq4wCjpHjmcnVEKood1U08kIfRGr8sDRoU/export?format=csv&gid=0
Reference:
Download link for Google Spreadsheets CSV export
Test
I did some quick tests on my end & after manually downloading the sheet file as a Comma Separated Values (CSV) file from the Google Sheet UI & after using the alternative solution, there's no issue with missing cells. But when using the gviz api link, the issue occurs:
If you set the column to 'Plain text' under the Format menu > Number, you should receive the data upon export.

How can I import a tab delimited (TSV) file saved on Google Drive into Google Sheets?

I saved a TSV file (it has to be TSV because reasons... I guess it could be .xlsx too), on my drive and I want to import it using =importdata("https://drive.google.com/open?id=<myfileID>")
This... almost works, but it seems to want to give each character a column (except that my data doesn't even have that characters. The error is:
Error
Result was not automatically expanded, please insert more columns (1096).
My data has 13 columns, and browsing the data in a text editor, has max about 125 characters. So even allocating a character per column it should still be able to show it
I've saved sample TSV and Sheets document, so perhaps you guys can help me out.
https://docs.google.com/spreadsheets/d/1Ri_FJ-ty9rB408KTzeLUGm8om4JX8q_Mh6x7Eh7bbIQ/edit?usp=sharing
https://drive.google.com/file/d/1ijERb-QPmeYA_GrcjB3dCckNKU2XiSd8/view?usp=sharing (the tsv file)
Answer:
You need to use the export/download link, rather than the share link.
Modification:
=IMPORTDATA(https://drive.google.com/u/0/uc?id=1ijERb-QPmeYA_GrcjB3dCckNKU2XiSd8&export=download)
You can get this link by visiting the share link for your TSV file, and hitting download in the top-right. A new tab will open that contains the URL of the export link.
You can also take the imported data and use the SPLIT function to separate the tabular data using CHAR(9):
=ARRAYFORMULA(SPLIT(IMPORTDATA(A3),CHAR(9),FALSE,TRUE))
Alternatively, you can use the File > Import > [Select File] menu item, then use the Append to current Sheet and Tab separator type to import any TSV file on your Drive to a Sheet.

SAS Stored Procedure User Enters List

Is it possible to created a Stored Procedure in SAS Enterprise Guide and allow the user to enter in a list of values, without having to manually enter in the list?
I use more Base SAS than EG, so I'm not an expert on Stored Procedures. Currently, an analyst in my area may have to search for a list of values like so:
012345678
123456789
231456789
091236574
439857345
120129038
230918239
....
....
N
and is using a Stored Procedure that was built to enter in these values. However, this is not efficient as this last can be >40 values, and SAS will only allow you to enter in one at a time.
I've been messing around with the prompt manager for an hour or so and haven't had any luck. I've also tried 'User selects from a static list', using an excel doc that I imported. Which worked great ad-hoc, but, because the values will always be different, I can't figure out how to make EG first import this excel doc, then bring up the prompt for her to select all the (new) values, then run the rest of the program.
Also, it seems that I would have to change the 'Static Value List' in the prompt manager every time the doc was imported, even if the rest of the program was conditioned on the import of the excel doc. I'm going to continue playing around with this, but looking for ideas as to if anyone has done this previously.
Sounds like you want "select multiple values from a dynamic list". I suggest you read the excel file that holds all the response options into a SAS dataset. Then register that dataset in the SAS metadata server. When you create a dynamic prompt you point to the source SAS dataset that holds the response options. After creating the prompt, you can update the dataset any time you want (add/delete records), and then STP user will see those updated response options in the prompts.
It may also be possible to register an Excel file in metadata instead of reading it into a SAS dataset. But I always try to limit Excel usage as much as possible.

Can I import multiple Excel ranges into SPSS?

I've got an absolutely horrible dataset in Excel (13,500 variables, a lot of them irrelevant to my purposes). I need to analyse in SPSS as I have a lot of data transformations to do... but SPSS 24 struggles with a dataset that size. Well... either SPSS struggles, or my work PC does.
Is there a way, when importing data from Excel, to import multiple ranges? Specifically, I want Column A (my unique identifier), then several other ranges (e.g. G:AC, DD:JJ, etc.).
/CELLRANGE=RANGE only seems to allow a single range.
If you have the appropriate ODBC driver for Excel, you can use the database reading facility in Statistics to select the fields. However, the catch with ODBC and Office is that the bigness has to match. If both are 32-bit, that's easy, but 64-bit Statistics would need 64-bit Office, and that's a world of hurt.
No (you can't specify multiple ranges), is the short answer. What you ought to be doing is importing the entire relevant range and then using SPSS commands to manipulate as you desire. For example using ADD FILES FILE with DROP sub command to delete irrelevant columns/variables.
I don't know of a way to directly import multiple ranges from Excel. You might try importing the file to an MS Access database first, then read the table from the database to SPSS using (in SPSS) "open database" --> "new query". The query editor will let you specify the fields you want to import.

Syntax to extract variable labels from SPSS file

I have hundreds of SPSS .sav files. For each one I want to extract the variable NAMES and variable LABELS as a two column table to a csv file. I know that this is straightforward by simply copying and pasting from the "Variable view" window, but I would really like to know how to do this using syntax. Is this possible?
Many thanks in advance for any help!
You might be interested in the GATHERMD extension command, It takes a wildcard for the file names and builds a dataset with three variables: the file name, the variable name, and the variable label. You could then just save that as a csv file.
This command requires the Python Essentials available with your Statistics installation or via the SPSS Community website (www.ibm.com/developerworks/spssdevcentral).
Using native Statistics syntax, DISPLAY DICTIONARY and CODEBOOK might be helpful, but they won't give you all this information in one table.

Resources