Dear all, I have a variable that I would like also to use it as a string. The reasons is that I want to collect results from different function to one table.. So when I use the colnames(mymatrix) <-c(function1.function2,function3) the function1, function2, function3 to be "converted" to simple strings so as colnames(mymatrix) <-c("function1","function2","function3") Could you please help me understand how I can do that in R? Regards [[alternative HTML version deleted]]
Hello, Not sure whether this is what you need. colnames(mymatrix)<-c("function1","function2","function3")> toString(colnames(mymatrix))#[1] "function1, function2, function3" A.K. ----- Original Message ----- From: Alaios <alaios at yahoo.com> To: R help <R-help at r-project.org> Cc: Sent: Monday, July 30, 2012 6:47 AM Subject: [R] Convert variable to STring Dear all, I have a variable that I would like also to use it as a string. The reasons is that I want to collect results from different function to one table.. So when I use the ?colnames(mymatrix) <-c(function1.function2,function3) the function1, function2, function3 to be "converted" to simple strings so as ?colnames(mymatrix) <-c("function1","function2","function3") Could you please help me understand how I can do that in R? Regards ??? [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Can you give us an example of what you mean by the functions listed below. Otherwise something like this seems to work xx <- 1 :4 x1 <- as.character(xx) mat <- matrix(1:12, nrow=3) John Kane Kingston ON Canada> -----Original Message----- > From: alaios at yahoo.com > Sent: Mon, 30 Jul 2012 03:47:45 -0700 (PDT) > To: r-help at r-project.org > Subject: [R] Convert variable to STring > > Dear all, > I have a variable that I would like also to use it as a string. The > reasons is that I want to collect results from different function to one > table.. So when I use the > colnames(mymatrix) <-c(function1.function2,function3) > the function1, function2, function3 to be "converted" to simple strings > so as > > colnames(mymatrix) <-c("function1","function2","function3") > > Could you please help me understand how I can do that in R? > > Regards > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.____________________________________________________________ GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM?, MSN? Messenger, Yahoo!? Messenger, ICQ?, Google Talk? and most webmails
You may be searching for the deparse(substitute(x)) idiom. Michael On Jul 30, 2012, at 5:47 AM, Alaios <alaios at yahoo.com> wrote:> Dear all, > I have a variable that I would like also to use it as a string. The reasons is that I want to collect results from different function to one table.. So when I use the > ?colnames(mymatrix) <-c(function1.function2,function3) > the function1, function2, function3 to be "converted" to simple strings so as > > ?colnames(mymatrix) <-c("function1","function2","function3") > > Could you please help me understand how I can do that in R? > > Regards > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Hello, Is this it? function1 <- function(x) print(x) name.function1 <- deparse(substitute(function1)) name.function1 Hope this helps, Rui Barradas Em 30-07-2012 11:47, Alaios escreveu:> Dear all, > I have a variable that I would like also to use it as a string. The reasons is that I want to collect results from different function to one table.. So when I use the > colnames(mymatrix) <-c(function1.function2,function3) > the function1, function2, function3 to be "converted" to simple strings so as > > colnames(mymatrix) <-c("function1","function2","function3") > > Could you please help me understand how I can do that in R? > > Regards > > [[alternative HTML version deleted]] > > > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]
Hello, You can check this link (http://econometricsense.blogspot.com/2010/12/r-code-example-for-neural-networks.html).? A.K. ________________________________ From: Rahul Bhalla <rahulbhalla_3521 at yahoo.com> To: arun <smartpink111 at yahoo.com> Sent: Monday, July 30, 2012 3:51 PM Subject: R-neuralnet code Can you please give me a simple R-neuralnet code and its interpretation.Also the concept of the compute function. ________________________________ From: arun <smartpink111 at yahoo.com> To: Alaios <alaios at yahoo.com> Cc: R help <r-help at r-project.org> Sent: Monday, July 30, 2012 5:34 PM Subject: Re: [R] Convert variable to STring Hello, Not sure whether this is what you need. colnames(mymatrix)<-c("function1","function2","function3")> toString(colnames(mymatrix))#[1] "function1, function2, function3" A.K. ----- Original Message ----- From: Alaios <alaios at yahoo.com> To: R help <R-help at r-project.org> Cc: Sent: Monday, July 30, 2012 6:47 AM Subject: [R] Convert variable to STring Dear all, I have a variable that I would like also to use it as a string. The reasons is that I want to collect results from different function to one table.. So when I use the ?colnames(mymatrix) <-c(function1.function2,function3) the function1, function2, function3 to be "converted" to simple strings so as ?colnames(mymatrix) <-c("function1","function2","function3") Could you please help me understand how I can do that in R? Regards ??? [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Hello Rahul, I can see comments for each line of the code which is not very hard to understand. From your earlier post, I think you were having some problems with the compute method.? Check this link (http://stackoverflow.com/questions/4891899/how-to-predict-new-cases-using-the-neuralnet-package).? Also, read the neuralnet package. Other links: 1.http://rgm2.lab.nig.ac.jp/RGM2/func.php?rd_id=neuralnet:neuralnet-package. 2. http://stackoverflow.com/questions/10939591/predicting-class-for-new-data-using-neuralnet 3. http://www.google.com/url?sa=t&rct=j&q=package%20neuralnet&source=web&cd=3&ved=0CFMQFjAC&url=http%3A%2F%2Fjournal.r-project.org%2Farchive%2F2010-1%2FRJournal_2010-1_Guenther%2BFritsch.pdf&ei=s2cXUIjpNsWvqAG1gIFw&usg=AFQjCNG0d5pvGlgTuHG9kmiQbgzywItDyw&cad=rja Hope it helps. A.K. ________________________________ From: Rahul Bhalla <rahulbhalla_3521 at yahoo.com> To: arun <smartpink111 at yahoo.com> Sent: Tuesday, July 31, 2012 12:51 AM Subject: Re: R-neuralnet code Thank you for the link but it is not completely convey the concept of neural networks what i need is a simpler code with the interpretation about the GW plots and also if you can give me the interpretation of this code #install.packages('neuralnet') library("neuralnet") #Going to create a neural network to perform sqare rooting #Type ?neuralnet for more information on the neuralnet library #Generate 50 random numbers uniformly distributed between 0 and 100 #And store them as a dataframe traininginput <-? as.data.frame(runif(50, min=0, max=100)) trainingoutput <- sqrt(traininginput) #Column bind the data into one variable trainingdata <- cbind(traininginput,trainingoutput) colnames(trainingdata) <- c("Input","Output") #Train the neural network #Going to have 10 hidden layers #Threshold is a numeric value specifying the threshold for the partial #derivatives of the error function as stopping criteria. net.sqrt <- neuralnet(Output~Input,trainingdata, hidden=3, threshold=0.01) print(net.sqrt) #Plot the neural network plot(net.sqrt) #Test the neural network on some training data testdata <- as.data.frame((1:10)^2) #Generate some squared numbers net.results <- compute(net.sqrt, testdata) #Run them through the neural network ________________________________ From: arun <smartpink111 at yahoo.com> To: Rahul Bhalla <rahulbhalla_3521 at yahoo.com> Cc: R help <r-help at r-project.org> Sent: Tuesday, July 31, 2012 1:37 AM Subject: Re: R-neuralnet code Hello, You can check this link (http://econometricsense.blogspot.com/2010/12/r-code-example-for-neural-networks.html).? A.K. ________________________________ From: Rahul Bhalla <rahulbhalla_3521 at yahoo.com> To: arun <smartpink111 at yahoo.com> Sent: Monday, July 30, 2012 3:51 PM Subject: R-neuralnet code Can you please give me a simple R-neuralnet code and its interpretation.Also the concept of the compute function. ________________________________ From: arun <smartpink111 at yahoo.com> To: Alaios <alaios at yahoo.com> Cc: R help <r-help at r-project.org> Sent: Monday, July 30, 2012 5:34 PM Subject: Re: [R] Convert variable to STring Hello, Not sure whether this is what you need. colnames(mymatrix)<-c("function1","function2","function3")> toString(colnames(mymatrix))#[1] "function1, function2, function3" A.K. ----- Original Message ----- From: Alaios <alaios at yahoo.com> To: R help <R-help at r-project.org> Cc: Sent: Monday, July 30, 2012 6:47 AM Subject: [R] Convert variable to STring Dear all, I have a variable that I would like also to use it as a string. The reasons is that I want to collect results from different function to one table.. So when I use the ?colnames(mymatrix) <-c(function1.function2,function3) the function1, function2, function3 to be "converted" to simple strings so as ?colnames(mymatrix) <-c("function1","function2","function3") Could you please help me understand how I can do that in R? Regards ??? [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.????