Page 1 of 1
Basic Q on R
Posted: November 23rd, 2010, 3:44 pm
by player
A real basic question on R I have a txt file and I am trying to read it into R but getting an error reading it in.I've set the path of R to where the folder is and then typed the following Santa <-read.table("IsThereASantaClaus.txt")but I get a whole host of errors Error in file(file, "rt") : cannot open the connectionIn addition: Warning message:In file(file, "rt") : cannot open file 'IsThereASantaClaus.txt': No such file or directoryI then tried puting the path direct > Santa <-read.table("C:\\Users\\Player\\IsThereASantaClaus.txt")and as > Santa <-read.table("C:\Users\Player\IsThereASantaClaus.txt")but still cant get it read.Can anyone help pleeeeease
Basic Q on R
Posted: November 23rd, 2010, 3:50 pm
by quantmeh
try copying file to where your R is.
Basic Q on R
Posted: November 23rd, 2010, 3:51 pm
by tradelink
R uses unix forwardslashes in paths rather than windows backslashes, sosanta <-read.table("/users/player/isthereasantaclaus.txt")or santa <-read.table("c:/users/player/isthereasantaclaus.txt")should work
Basic Q on R
Posted: November 23rd, 2010, 4:19 pm
by tags
QuoteSanta <-read.table("IsThereASantaClaus.txt")you just typed in the name of your file.what about your working directory ?you may set your working directory :example : setwd("C:/Users/WilmottForumUser/desktop")you then can open you file :data<-read.table("IsThereASantaClaus.txt")but that very depends on the actual content of your file.in any case, you should specify the way your file is organized and what your data look like using the sep, dec, heade, na.strings keywords.that way you would be sure to open your file properly.édouard
Basic Q on R
Posted: November 23rd, 2010, 4:22 pm
by player
thanks guys. Now working
Basic Q on R
Posted: November 29th, 2010, 9:09 am
by player
For some reason when I run the following on a new PC > source("
http://www.rmetrics.org/Rmetrics.R")> install.Rmetrics()I get the following error msg in file(file, "r", encoding = encoding) : unable to open connectionIn addition: Warning message:unable to resolve '
www.rmetrics.org'. in: file(file, "r", encoding = encoding)Any idea what is going wrong?It worked on my old PC last week
Basic Q on R
Posted: November 29th, 2010, 9:36 am
by Hansi
Do you have any kind of outgoing firewall? Zonealarm etc? Which Mirror are you using? Which OS? Which R version?
Basic Q on R
Posted: July 11th, 2011, 8:02 am
by player
There is a firewall. The version is 2.5.1
Basic Q on R
Posted: July 11th, 2011, 8:18 am
by player
I guess the issue is how do I change the intenet proxy to connect R to the web?
Basic Q on R
Posted: July 11th, 2011, 9:17 am
by Hansi
Set the proxy in IE and then start R with: "C:\Program Files\R\R-2.xx.0\bin\i386\Rgui.exe" --internet2 or change the shortcut accordingly.
Basic Q on R
Posted: September 5th, 2011, 11:56 am
by player
Another basic q on R I have written the following function in an R script logistic <- function(r,x) r*x*(1-x)and saved it as logistic.RIm now trying to call it in the R console. How can I do this?I've set the wd to the same path as to where logistic.R is saved but still nothing....
Basic Q on R
Posted: September 5th, 2011, 12:19 pm
by Hansi
You'll need to source it in. source("/path/to/file/logistic.R") or source("logistic.R") since it's in the working directory.
Basic Q on R
Posted: September 6th, 2011, 5:58 am
by player
thanks