showing the photos from a folder - jupyter-notebook

I am using Jupyter notebook.
I have written a program that converts my video into some frames. For example frame001, frame002, ...., frame030 in the directory/data/....
Now I want to write a command to show the photos from the folder in order. After I press escape, the frame is closed and next frame is shown aromatically until the last frame.
Any help would be appreciated.
Best kinds
Vahid
I want to write a command to show the photos from the folder in order. After I press escape, the frame is closed and next frame is shown aromatically until the last frame.

Related

When exported to csv it changes some cell names, how can i prevent this?

I have some data points (gene id) that are like "dates" for example MAR1 but when i export it to csv it keeps changing it to 1.Mar as if it's an actual date.
How can I keep it as MAR1 not keep changing it as date format?
When i try to fix this on excel it trying to change it into txt format it changes into cell number.
You should look into PowerQuery if you are working with CSV format.
Open a blank workbook, instead of opening the file go to the Data Tab -> Get Data -> From Text/CSV and locate the file.
(You can also pick Excel file if you plan to use writexl)
Click "Transform Data" and from there you can pick which formats you want by clicking on the small icons in the columns (in your case set the column to text). You can also do many other things such as sort or convert a data to a week number.
Click "Close & Load" and it will appear in a new tab as a table.
What's nice about PowerQuery if you are doing any post analysis in Excel is that next time you export in R, you only have to hit "Refresh All" in the data tab and it will pull your new data in and apply transformations provided you haven't changed any of the column/names.

copying web table to ms excel does not work anymore due to changed web structure

For statistical analysis in performance sports, I often collect data form https://www.fis-ski.com/en and import it to MS Excel by copy/paste, before I work on it in RStudio. As FIS updated its website structure recently, the imported data shows up in one column and it is not possible to convert it back to a structured table via "text to columns". I tried it also by using a macro but as the imported data doesn`t have a uniform structure, because missing data (NA´s) are not shown as empty cells, converting data is quite tricky for me as a "non-programmer". The data I would like to extract are the following:
https://www.fis-ski.com/DB/alpine-skiing/biographies.html?lastname=&firstname=&sectorcode=AL&gendercode=M&birthyear=1980-2004&skiclub=&skis=&nationcode=SUI&fiscode=&status=&search=true
...but as I need the results of every single athlete in this list, here an example...
https://www.fis-ski.com/DB/general/athlete-biography.html?sectorcode=AL&seasoncode=&competitorid=230012&type=result&categorycode=&sort=&place=&disciplinecode=&position=&limit=1000
..., I have a lot of data which I need to get in order! So, I have two questions:
Is there a easy method to get the copied data back in order as a table?
Is there a way to extract the results-data from all athletes (SUI, male, YoB 1980-2004) without switching from athlete to athlete?
Thank you very much in advance... looking forward to your answers...
Greetings!!
You wrote that you are not a programmer, so this would be very complicated to explain to you, but I have a solution for you. On any of those two pages, open your browser developer tools with F12 and go to the "console" tab, and then paste this and press Enter:
copy([...$('.thead .container, .table-row .container')].map(e => [...$(e).children(':visible:not(:has(.g-sm-24), :has(.g-xs-24), :has(.pale))'), ...$(e).find(':has(.g-sm-24), :has(.g-xs-24), :has(.pale)').find(':visible.g-sm-24, :visible.g-xs-24, :visible.pale')].map(c => c.innerText.replace(/\n/g, ' ').trim()).join('\t')).join('\r\n'))
This will copy a nice table for you into the clipboard, which you can paste into Excel.
Small caveat: The order of the columns is a bit different (because some of those columns are "special" in that they are actually a group of columns which is shown/hidden together normally depending on whether you are on mobile or not).
By the way, this is stored in a command history then, next time you just need to press the up arrow ↑ key in the command line field to recall the command and press Enter again.

In R, is there any way to automatically run an output after it has been printed?

Sorry if this sounds a bit messy, I'm new to using R. I have a data frame named "AB13" ( a postcode) and I am using a list of all postcodes which I imported as a .csv file. Is there any way I can print one of the columns and run it through the console automatically. Say print the 10th element of the list, which is AB13. Then it will display AB13 ( the data frame)?
I have tried using print, cat and multiple other print functions but I haven't been able to get anywhere.
You can do
get(your_list[[10]])

BlySky Statistics - File naming conventions

When opening file 'TestFile.RData' in BlueSky Statistics it is opened with this name PLUS Dataset3 attached. Looks like this in tab TestFile.RData(Dataset3)
I would like to use my original name when using r code in the r command editor but from what I see BlueSky wants me to use the Dataset3 name.
Please clarify this file name issue for me.
If my original name is changed I see issues with reproducing things - as the given name of Dataset3 is not controllable.
Regards
Your observation is correct. When ever a file is opened in BlueSky Statistics (that is not an R datafile) we create a dataframe object in R. We name these objects sequentially namely Dataset1, Dataset2,Dataset3, etc. We could always use the name of the original file, however we went with Dataset1,Dataset2,Dataset3 for compatibility with SPSS. Many of our users come from SPSS and that is exactly what SPSS does. There is a simple work around, see below.
To work around this you need to change the default code we use to open the dataset. To see the code in the output window, Go to the top level menu Tools , Tools->Configuration settings->Select the Output tab and select the checkbox near the text "Show syntax in output window"
The code you will see when you open a dataset in the output Window is
BSkyloadDataset(fullpathfilename='C:/Users/Aaron_2/Documents/BlueSky Statistics/Sample Datasets/IRT/engagement.csv', filetype='CSV', worksheetName='',load.missing=FALSE, character.to.factor=FALSE, csvHeader=TRUE, isBasketData=FALSE, trimSPSStrailing=FALSE, sepChar=',', deciChar='.', datasetName='Dataset2')
All you need to do is change the datasetName parameter to the name you want to use
I will also add an enhancement to make the default behavior of naming the dataset when opening files to be the name of the file. This is easy to do.
With R datasets this is not a problem because we load all dataframe objects into the grid. The name of the dataset in the grid, continues to be the dataset object
BlueSky is one of the few packages that use R and allow you to open and work on multiple data files at once. This naming approach is its way of allowing that while using files that have not yet been stored as R data files (.RData). After importing data from a non-R file, simply use "File> Save as" and save it as an R Object (.RData). The next time you open that file, it will maintain the name you've given it.

editing a dataframe in R invoking vi

I am trying to edit a dataframe, content and titles from R.
there is a command edit(), but you can also invoke a vi editor by using vi([data.frame]).
You can view it and edit, it, but it saves the file to a file that I don't seem able to access and turn into a new edited data.frame.
example:
data(Orange)
test <- vi(Orange)
you should bring up a vi editor, and can change things here. if you save it, it creates a separate file in some temp directory. When you go back to R, and look at test, you'll see that none of your changes are in there.
Anyone know how to invoke a vi editor on the data.frame, such that the changes will be saved to a new data.frame?
I am running the same setup: OSX and R 3.0.1 and don't have an issue -- perhaps you're missing the saving step?
data(Orange)
test <- vi(Orange)
Then i edit the first data point, and hit the red button -- which opens a dialog box to save. You can also select save by hitting Command-S or selecting it from the menu.
This will not alter Orange, but it will pass the altered Orange to test.

Resources