[R] Automation of R input
Hi all, I have R script which during its run require an input like this: choose between one of the grouping factor available : c("Village", "Country") can I automate this part, in other word to pass for example Village when I am running the script. One more thing the script is the TimeSeriesAnalysis {ndvits}. Thanks in advance for any help or suggestion. Regards, Vahe [[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.
[R] Re
Hi andrija djurovic, Thanks a lot for your replyand for your useful suggestions. Actually I need to run this script without user interaction, so when it is required to input Village I need to pass it automatically not by the user. Regards, Vahe [[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.
[R] One more question...
Thanks a lot Andrija... I run the following in Rsutdio: library("ndvits", lib.loc="/home/vahe/R/i686-pc-linux-gnu-library/2.15") ndvidirectory=paste(system.file("extdata/VITO_Mzimba", package="ndvits"), "/", sep="") region="Mzimba" Ystart=2004 Yend=2006 shape="SLP_Mzimba" shapedir=paste(system.file("extdata/shape", package="ndvits"), "/", sep="") outfile = "mzimbaTS2.txt" outfile2 = "MzimbaTS2.pdf" outfiel3 = "my.pdf" signal = TimeSeriesAnalysis(shape, shapedir, ndvidirectory, region, Ystart, Yend, outfile, outfile2) Village So the village is passed, but when I am running it in R script from the linux terminal it is repeating the line when I need to enter village continually can you suggest anything. Regards, Vahe [[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.
[R] One more question please...
I executed the code in rstudio successfully: library("ndvits", lib.loc="/home/vahe/R/i686-pc-linux-gnu-library/2.15") ndvidirectory=paste(system.file("extdata/VITO_Mzimba", package="ndvits"), "/", sep="") region="Mzimba" Ystart=2004 Yend=2006 shape="SLP_Mzimba" shapedir=paste(system.file("extdata/shape", package="ndvits"), "/", sep="") outfile = "mzimbaTS2.txt" outfile2 = "MzimbaTS2.pdf" outfiel3 = "my.pdf" signal = TimeSeriesAnalysis(shape, shapedir, ndvidirectory, region, Ystart, Yend, outfile, outfile2) Village But the same code is not going well in linux terminal by R script, it is continually repeat the line enter Village or Country, what is the difference here between R script and rstudio script ? Regards, Vahe [[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.
[R] Need a little help about this script...
library("ndvits", lib.loc="/home/vahe/R/i686-pc-linux-gnu-library/2.15") ndvidirectory=paste(system.file("extdata/VITO_Mzimba", package="ndvits"), "/", sep="") region="Mzimba" Ystart=2004 Yend=2006 shape="SLP_Mzimba" shapedir=paste(system.file("extdata/shape", package="ndvits"), "/", sep="") outfile = "mzimbaTS2.txt" outfile2 = "MzimbaTS2.pdf" outfiel3 = "my.pdf" signal = TimeSeriesAnalysis(shape, shapedir, ndvidirectory, region, Ystart, Yend, outfile, outfile2) Village I have run this in rstudio successfully, so the Village is passed to c() function, but when I am trying to run it from R script in linux terminal the line of c() input is repeatedly coming back and it is not working... any help or suggestion, thanks in advance. Regards, Vahe [[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.
[R] Fwd: One more question please...
I executed the code in rstudio successfully: library("ndvits", lib.loc="/home/vahe/R/i686-pc-linux-gnu-library/2.15") ndvidirectory=paste(system.file("extdata/VITO_Mzimba", package="ndvits"), "/", sep="") region="Mzimba" Ystart=2004 Yend=2006 shape="SLP_Mzimba" shapedir=paste(system.file("extdata/shape", package="ndvits"), "/", sep="") outfile = "mzimbaTS2.txt" outfile2 = "MzimbaTS2.pdf" outfiel3 = "my.pdf" signal = TimeSeriesAnalysis(shape, shapedir, ndvidirectory, region, Ystart, Yend, outfile, outfile2) Village But the same code is not going well in linux terminal by R script, it is continually repeat the line enter Village or Country, what is the difference here between R script and rstudio script ? Regards, Vahe [[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.
[R] Simulate user input in R
Dear all, Can we simulate user input in R ? for example if we have a function which needs an input from the user to continue its work, can we automate this step (simulate the input...) Here is the sample: choose between one of the grouping factor available : c("Village", "Country") we need to enter Village or Country to continue.can I automatically pass one of the values without user input. Regards, Vahe [[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.
Re: [R] Simulate user input in R
Thanks Jeff for your reply... The code is not written by me it is the NDVITS package which is used in R. TimeSeriesAnalysis {ndvits} And at that point it requires my input. Regards, Vahe On Wed, Apr 24, 2013 at 11:04 AM, Jeff Newmiller wrote: > Your example is not reproducible, so it is open to misinterpretation. > > Normally the approach taken in R is not to wait for user input, but have > the user call the function with the desired values. One interpretation of > your question is that the function you are using is broken by design, and > you should re-write it. > > --- > Jeff NewmillerThe . . Go Live... > DCN:Basics: ##.#. ##.#. Live > Go... > Live: OO#.. Dead: OO#.. Playing > Research Engineer (Solar/BatteriesO.O#. #.O#. with > /Software/Embedded Controllers) .OO#. .OO#. rocks...1k > --- > Sent from my phone. Please excuse my brevity. > > Vahe nr wrote: > > >Dear all, > > > >Can we simulate user input in R ? > >for example if we have a function which needs an input from the user to > >continue its work, can we automate this step (simulate the input...) > > > >Here is the sample: > >choose between one of the grouping factor available : > >c("Village", "Country") > >we need to enter Village or Country to continue.can I automatically > >pass one of the values without user input. > > > >Regards, > > Vahe > > > > [[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]] __ 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.
[R] Error in validObject(.Object) :
Hi all, I am trying to run R NDVITS package, and I am getting the following error: Error in validObject(.Object) : invalid class GridTopology object: cells.dim has incorrect dimension Can you please suggest any idea about understanding this error and solving it. Regards, Vahe [[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.
[R] read .csv file and plot a graph
Hi all, I have a big .csv file (21Mb with 100 rows) it has this shape: x 1 NaN 2 NaN 3 0.23 and so on. So the first column has x as a header then row number, the second column contains values between -1,1 and NaN for empty values. What should I need to do is: create a new .csv file from this one excluding NaN values and plot a line graph using the new .csv file. Or can I use the old .csv file to plot a graph excluding NaN values. Thanks in advance for any help or suggestions. Regards, Vahe [[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.