Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
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.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
I am having the problem that when I use setwd() with a path that includes spaces (e.g. setwd("C:/Users/Name/My Documents/") I get the error message
"cannot change working directory"
I am a bit suprised that I did not find much about this here or on google - so it must either be a rare error or everyone knows about it I reckon. Either way, is there a why to work around it?
I am using Windows 7 and R version 3.0.2.
R cannot setwd into a directory that it doesn't have 'x' (execute) permission for.
This should work, but if really needed, you can use the function shortPathName.
> shortPathName("C:/Program Files (x86)/Adobe/")
[1] "C:\\PROGRA~2\\Adobe\\"
I can replicate your error if I just copy and paste
setwd("C:/Users/Name/My Documents/")
to console as is. The problem is that R cannot find the specified path. I believe that you should replace "Name" with your username...
If I replace "Name" with my username, it works as expected.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 4 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
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.
Improve this question
Fundamental stuff but i couldn't seem to get around this. I performed the following process:
d1<-read.csv('hourly.csv',sep=",",header=F)
names(d1)<-c("date","rain","q","qa","qb")
d2<-read.csv('event.csv',sep=",",header=F)
names(d2)<-c("enum","st","et","rain2","qtot")
for(k in 1:206){
st<-d2[k,2]
et<-d2[k,3]
Datetime<-d1[st,]
print(Datetime)
write.csv(Datetime, file="DatesA3.csv")
}
In the end, i exported the results to a csv file. There are 206 rows altogether and they display fine in R. But when exporting, only the last row is exported in the csv file. I tried multiple things such at write.table, append, etc. but nothing seems to work.
How do i export every row into one file?
Please advise and thank you!
Datetime[k, ] <- d1[st, ] # instead, otherwise you overwrite
# and write the result outside the loop
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I'm struggling to find the answer to this very basic question and to make the here() function work (from the here package). I'd be glad if someone could help me with that.
What's a file .here mentionned in this github? And how can I create one ?
I've tried adding a text file called '.here.txt' in my workflow (where I want the here() function to "start") but it doesn't work.
You don't need a here file. That's one of the possibilities though. But if you want to use that route then make a file called .here
Not .here.txt or here.txt or any other variant you can think of. Literally just .here
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 5 years ago.
Improve this question
When typing accented characters (á, é, í, ó, etc.) in the source section in RStudio, they don't display correctly. I'll give two examples to explain:
When I try typing this:
"Ótrúlega óþolandi þegar ég skrifa íslenska stafi."
this appears as:
"´ótr´úlega ´óþolandi þegar ´ég skrifa ´íslenska stafi"
(translation: "Incredibly annoying when I write Icelandic letters.")
When I try typing this:
"ááóóééíía"
this appears as:
"´á´áá´ááó´ááóó´ááóóé´ááóóéé´ááóóééí´ááóóééíía"
(translation: This is nonsense...)
I have no idea why this is happening. I'm using RStudio on Mac. Any help would be greatly appreciated.
It seems like this was a bug in RStudio. I installed the latest version of RStudio and this problem disappeared.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
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.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
I'm trying to begin using plotly for R, but I'm having trouble with an error about username. When I try to execute the following code...
test=ggplot(diamonds,aes(x=diamonds$carat,y=diamonds$price))+geom_point()
test2=plotly(test)
plotly(test)
...I get the error message:
Storing 'username' as the environment variable 'plotly_username'
Error in Sys.setenv(plotly_username = username) :
wrong length for argument
I thought plotly's R package was available for use without a username via htmlwidgets. As far as I can tell, I'm using the latest version of plotly, ggplot, and htmlwidgets. What am I doing wrong?
You have to use ggplotly()
So,
test <- ggplot(diamonds,aes(x = carat,y = price))+ geom_point()
ggplotly(test)
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 years ago.
Improve this question
I'm working on Slackware and I'm trying to change my working directory in order to import a xlsx.
setwd("</home/diego/Downloads>")
Error in setwd("</home/diego/Downloads>") :
cannot change working directory
This happens when directory path is wrong. Two steps may solve this:
First, check what's your current working directory in terminal or use getwd() with R
Second, setwd("path") according to your current working directory, for example, setwd("diego/downloads"), setwd("../../abc/def"), certainly you should drop the < and >
Drop the < and > from the directory name.