Hi
I'm working with a data frame which contains a textual variable named "Date". Each cell of this variable contains a date and an hour (dd/mm/yy hh:ss).
I would like to extract the hour in a new variable.
How can I do that with JAMOVI. Is the "split" fonction the good solution. Can you explain me how does it work ?
Furthermore, do you know if it is possible with JAMOVI to concatenate two variables to make one unique variable (in that case, to concatenate the "Date" and the "sortie" variables)
Thank you for your help
extracting part of a text variable
Re: extracting part of a text variable
hi,
i would extract the hour with the formula:
INT(SPLIT(SPLIT(C, ' ', 2), ':', 1))
SPLIT(C, ' ', 2) says split the variable C where ever there are spaces, and give me the 2nd chunk.
SPLIT('04/05/23 05:35', ' ', 1) gives '04/05/23'
SPLIT('04/05/23 05:35', ' ', 2) gives '05:35'
then i would take that value, and split it where the colon is:
SPLIT('05:35', ':', 1) gives '05'
the final step is to convert '05' to a number (at the moment, its being treated like 'text')
INT('05') gives 5 ...
we run this all together and we get:
INT(SPLIT(SPLIT(C, ' ', 2), ':', 1))
cheers
i would extract the hour with the formula:
INT(SPLIT(SPLIT(C, ' ', 2), ':', 1))
SPLIT(C, ' ', 2) says split the variable C where ever there are spaces, and give me the 2nd chunk.
SPLIT('04/05/23 05:35', ' ', 1) gives '04/05/23'
SPLIT('04/05/23 05:35', ' ', 2) gives '05:35'
then i would take that value, and split it where the colon is:
SPLIT('05:35', ':', 1) gives '05'
the final step is to convert '05' to a number (at the moment, its being treated like 'text')
INT('05') gives 5 ...
we run this all together and we get:
INT(SPLIT(SPLIT(C, ' ', 2), ':', 1))
cheers
Re: extracting part of a text variable
concatenating variables couldn't be simpler:
Re: extracting part of a text variable
Hi Jonathon
thank you for your answer. It works very well. Jamovi is really an amazing tool
thank you for your answer. It works very well. Jamovi is really an amazing tool