Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I am not sure why I cannot do write the following code.
as.Date(20110505, %Y%m%d)
I receive the error given in the title. Can anyone help me out?
It should be string with the format also in quotes
as.Date(as.character(20110505), "%Y%m%d")
#[1] "2011-05-05"
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 days ago.
Improve this question
I'm lost : i'd like to convert chararcter to date using as.Date() in R. I genuinely don't know what i missed with such a simple code. Here is an example
week_dates <- as.Date("06/20/2022", format ="%d/%m/%Y")
week_dates return only NA. Any idea what i missed ?
Thanks in advance !
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 months ago.
Improve this question
function "%n%" not working even though I've loaded package dplyr.
mutate(category = ifelse(Year.Last.Used %n% c("2015", "2016"),"baseline","treatment"))
Caused by error in Year.Last.Used %n% c("2015", "2016"):
! could not find function "%n%"
How to fix the error?
I think that you probably want to use %in%..
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
install.packages(qwraps2)
Error in install.packages : object 'qwraps2' not found
This package wont install, I get the above error. Can anyone help?
Try install.packages("qwraps2") instead.
it will not work without the quotes around package name
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I know that is really simple. I'm trying to calculate:
-2ˆ2 -(2.6)ˆ2 * (1/2)
Error: unexpected input in "-2�"
When I replace the ˆ with ^ it works on my system.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I have an error
> for (i in 1:(cutoff_size-1)){work$group[i]=rep(c(0,1),c([i]-1,cutoff_size-[i]-1))}
Error: unexpected '[' in:"for (i in 1:(cutoff_size-1)){work$group[i]=rep(c(0,1),c(["
'cutoff_size' is numeric.
How can I solve this problem?
for (i in 1:(cutoff_size-1)){work$group[i]=rep(c(0,1),c(i-1,cutoff_size-i-1))}
this is probably what you're looking for.
[] are used to refer to position in array/data table/list.
If you're using it in a mathematical operation, you do not need the [] around the i.