Hi, community. I'm having a problem with an OpenOffice Calc's file. I have the first column (A column) full by DATE and TIME together:
2000-10-14 8:30:05
, just like that, as POSIX format.
The problem is, there are 16387 columns full in that format and I want to make a vector with 2000-10-14 8:30:05
type. I can't put excel cells as text because they become: 2000101483005
, either put them as number because when I import in R, it makes the equation. Is there any chance that allows me import this format as a vector (and not write each 2000-10-14 8:30:05
between commas?
How are you reading the OpenOffice Calc file?
Try this, where "dats.ods" is the name of your file.
library(readODS)
dat1 <- read_ods("dats.ods")
You may have to install {readODS} first.
install.packages("readODS")
It says
Error: file does not exist
I guess I have to import first but, how should I? If I try it from "Excel", I can't
No, that is what this is supposed to do.
dat1 <- read_ods("dats.ods")
It looks likely that you have an incorrect file path.
What is your actual command? Just copy it and paste it between
```
```
The read statement below assumes that your file is in your working directory. It may be somewhere else.
dat1 <- read_ods("dats.ods")
Do
getwd()
to see where your working directory is.
If the Calc file is not in that directory you can move it to there or, probably better, just add the path to the file name. For example, if I have a file in the folder (directory) RJunk I would write this. Note I am using Linux.
dat1 <- read_ods"/home/john/RJunk/dats.ods"
I think the Windows equivalent is
dat1 <- read_ods("C:/john/RJunk/dats.ods")
Note that in R we use / rather than the Windows \ when setting a file path.
I checked getwd() -I wonder why the last file is opened when I press RStudio icon, by the way-, but. I put it in the correct folder, i think. Let's see why it doesn't work.
getwd()
install.packages("readODS")
library(readODS)
#>The name of my file: " HECHO_SC Dehesa 2023_IRGASON "
irgason <- read_ods("HECHO_SC Dehesa 2023_IRGASON")
It could be because of the spaces between words? It doesn't make sense.
THe file name is:
HECHO_SC Dehesa 2023_IRGASON.ods
You need to add the .ods
I do not think the spaces are likely to be a problem but, on general principles I avoid them.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.