[R] creating a list of dataframes

2010-12-03 Thread lord12
I am iterating through multiple files and storing dataframes in a list. I want to perform calculations on these dataframes. How would I go about doing this? I do: num_files- list.files() list = c() for(x in num_files) { frame = read.table(x) list = c(list, assign(paste(frame,x),frame)) } For

[R] How to unquote string in R

2010-11-03 Thread lord12
s= Hey a = Hello table = rbind(s,a) write.table(table,paste(blah,.PROPERTIES,sep = ),row.names = FALSE,col.names = FALSE) In my table, how do I output only the words and not the words with the quotations? -- View this message in context:

[R] writing a table

2010-10-26 Thread lord12
When ever I write a table of columns to a csv file the columns are offset by one column and do not match the column headers. How do I align my columns with the column headers? Also, how do I change the name of my column headers. -- View this message in context:

[R] How to write to sqlite files

2010-10-19 Thread lord12
In R, I know how to write ti csv files. However, how do I write to database files? -- View this message in context: http://r.789695.n4.nabble.com/How-to-write-to-sqlite-files-tp3002586p3002586.html Sent from the R help mailing list archive at Nabble.com.

[R] how to convert string to object?

2010-10-17 Thread lord12
temp = ~aparch( temp1 = paste(temp,1, sep = ) temp2 = paste(temp1,1, sep = ,) temp3 = paste(temp2, ),sep = ) temp 3 is a character but I want to convert to formula object. How do I do this? -- View this message in context:

Re: [R] how to convert string to object?

2010-10-17 Thread lord12
how do I convert it to a language object? -- View this message in context: http://r.789695.n4.nabble.com/how-to-convert-string-to-object-tp2999281p2999299.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

[R] Evaluating R functions in Java with dynamic input

2010-10-16 Thread lord12
So I have an R function: function = foo(x) { return(x) } In java: I create an Rengine: Rengine re = new Rengine(args,false,new TextConsole()); int blah = 5 re.eval(foo(blah)); I get an error(object blah not found). How do I dynamically evaluate my functions given user input(without hard

[R] Calling R function in Java that in turn calls a Java function

2010-10-16 Thread lord12
I have a function: call = function() { library(rJava) .jinit(classpath=C:/Documents and Settings/GV/workspace/Test2/bin, parameters=-Xmx512m) blah = .jcall(Test2, D, sum, 2,2) return(blah) } In java I do re.eval(call()) and I get a value of null. If I run the call function directly from R,

Re: [R] RJava help

2010-10-15 Thread lord12
public class my_convolve { public static void main(String[] args) { } public static void convolve() { System.out.println(Hello); } } library(rJava) .jinit(classpath=C:/Documents and Settings/GV/workspace/Test/bin,

[R] R functions in Java

2010-10-14 Thread lord12
Suppose I have a function in R called foo. foo = function(x) { print(x); } When I create the Rengine re and do re.eval(foo(1)) I get the output 1. However, if I create a string variable in java String num = 1 and do re.eval(foo(num)), I get an error saying that num cannot be found. How can

Re: [R] R functions in Java

2010-10-14 Thread lord12
Any advice? -- View this message in context: http://r.789695.n4.nabble.com/R-functions-in-Java-tp2995428p2995490.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] R functions in Java

2010-10-14 Thread lord12
For example, if I have the function in R: sum = function(a,b) { sum = a+b return sum } In Java: re.eval(sum(a,b)) gives me an error. -- View this message in context: http://r.789695.n4.nabble.com/R-functions-in-Java-tp2995428p2995620.html Sent from the R help mailing list archive at

[R] RJava help

2010-10-14 Thread lord12
I need help with RJava. So I run this R code: library(rJava) #load the rJava library .jinit(classpath=c:/Documents and Settings/GV/workspace/Test/src, parameters=-Xmx512m) #the above is to load the Java virtual machine, x = runif(1000) y = runif(1000) #the above are two vectors to convolve

[R] Extracting index in character array.

2010-10-13 Thread lord12
If I have a character array: list = c(A, B, C) how do I access the third element without doing list[3]. Can't I find the index of C using a particular function? -- View this message in context: http://r.789695.n4.nabble.com/Extracting-index-in-character-array-tp2994029p2994029.html Sent from

[R] running own function in Java?

2010-10-11 Thread lord12
How do I run my own unique function in eclipse? -- View this message in context: http://r.789695.n4.nabble.com/running-own-function-in-Java-tp2990420p2990420.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

[R] how to convert list to language object

2010-10-07 Thread lord12
If I have a list: list = c(~garch(1,1), ~arma(1,1)) and I run typeof(list[1]), the output is a list object. But I want each element in the list to be a language object. How do I transform these list objects to language objects? -- View this message in context:

Re: [R] How to run own R functions in JRI

2010-10-07 Thread lord12
So I copy and pasted my function to the R startup file. However, in my function, I change directories. When I run the function in Eclipse, I get a message in the console, Cannot change working directory. Why is this? -- View this message in context:

Re: [R] How to run own R functions in JRI

2010-10-07 Thread lord12
Nevermind about the previous post. However, I in the retest sample code, I can run my own function in the command line. But, say I am creating a GUI and I want the user to enter the model parameters. How do I, within the java code, explicity call my unique function without going to the console?

Re: [R] How to run own R functions in JRI

2010-10-07 Thread lord12
So if I have the R function foo and I have my main method in Java how would I call the method foo? What would be the syntax?: Do I create an REengine first? public static void main(String[] args) { } -- View this message in context:

[R] Installing JGR

2010-10-06 Thread lord12
So I installed JGR and I am assuming that the JGR comes prepackaged with JRI. When I try to run the example JRI programs in Eclipse, the line: iimport org.rosuda.JRI.Rengine gives me an error. Why is this? -- View this message in context:

[R] GARCH models

2010-10-06 Thread lord12
I know in the API the formula for GARCH can be: garch(1,1) and arma(2,1)+apaarch(1,1). Are there any other possibilities for GARCH models or are these the only two models? -- View this message in context: http://r.789695.n4.nabble.com/GARCH-models-tp2957125p2957125.html Sent from the R help

[R] ARIMA models

2010-10-06 Thread lord12
I know for ARIMA models in R, there is an order parameter. I want to create a diverse set of ARIMA models by modifying the p,q,and d terms. I have a for loop that applies ARIMA models to a time series in this order: ARIMA(1,1,1) ARIMA(2,2,2) ARIMA(3,3,3) ARIMA(4,4,4) ARIMA(5,5,5). Does this make

Re: [R] Installing JGR

2010-10-06 Thread lord12
When I installed rJava, and try to run the examples from JRI on eclipse, these: import org.rosuda.JRI.Rengine; import org.rosuda.JRI.REXP; import org.rosuda.JRI.RList; import org.rosuda.JRI.RVector; import org.rosuda.JRI.RMainLoopCallbacks; cannot be resolved. Anyone know why? -- View this

[R] How do call own methods using JRI?

2010-10-06 Thread lord12
If I have a defined a method in R, mergeFiles(), how would I call this in Java. What special packages would I need to import? -- View this message in context: http://r.789695.n4.nabble.com/How-do-call-own-methods-using-JRI-tp2957168p2957168.html Sent from the R help mailing list archive at

Re: [R] How to iterate through different arguments?

2010-10-06 Thread lord12
Thanks a lot! I have one other question,however. If I want to have two garchFits, garchFit(~aparch(1,1), data = sunspot.year) and garchFit(~arma(2,1)+apaarch(1,1), data = sunspot.year), how do I automate the creation of these models? for(k in 1:2) { garchFit~...,data = sunspot.year), } I

[R] How to run own R functions in JRI

2010-10-06 Thread lord12
Suppose I have implemented my own R function. How do I call this function in Eclipse using JRI? -- View this message in context: http://r.789695.n4.nabble.com/How-to-run-own-R-functions-in-JRI-tp2965288p2965288.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] How to run own R functions in JRI

2010-10-06 Thread lord12
I am still a little unsure of how I would do this. I do not want to install GEdit. Is there anyway in the retest in the included example that you can show me how I would do this? My function is: lol = function(x,y) { sum = x+y mod = sum %5 return mod } -- View this message in

Re: [R] How to iterate through different arguments?

2010-10-04 Thread lord12
any solutions? -- View this message in context: http://r.789695.n4.nabble.com/How-to-iterate-through-different-arguments-tp2953511p2953608.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Creating R objects in Java

2010-10-04 Thread lord12
It seems that you can call Java objects from R but that you cannot call R objects from Java using the RJava interface. -- View this message in context: http://r.789695.n4.nabble.com/Creating-R-objects-in-Java-tp2904497p2953611.html Sent from the R help mailing list archive at Nabble.com.

[R] How to iterate through different arguments?

2010-10-03 Thread lord12
If I have a model line = lm(y~x1) and I want to use a for loop to change the number of explanatory variables, how would I do this? So for example I want to store the model objects in a list. model1 = lm(y~x1) model2 = lm(y~x1+x2) model3 = lm(y~x1+x2+x3) model4 = lm(y~x1+x2+x3+x4) model5 =

[R] Creating R objects in Java

2010-10-01 Thread lord12
How do you call R methods from Java? I want to create a GUI using Swing in Jaa that calls R methods in Java. -- View this message in context: http://r.789695.n4.nabble.com/Creating-R-objects-in-Java-tp2904497p2904497.html Sent from the R help mailing list archive at Nabble.com.

[R] Looping through different arguments

2010-10-01 Thread lord12
If for example I have garchFit(~garch(1,1) but I want to loop through all the different combinations of ARMA/GARCH/APARCH. Another model could be ~arma(2,1)+apaarch(1,1). How do I transition between garch(1,1) and arma(2,1)+apaarch(1,1) using a for loop. -- View this message in context:

Re: [R] convert to csv file

2010-09-17 Thread lord12
I get an error message: Error in file(file, ifelse(append, a, w)) : invalid 'open' argument How do I resolve this? -- View this message in context: http://r.789695.n4.nabble.com/convert-to-csv-file-tp2543232p2544070.html Sent from the R help mailing list archive at Nabble.com.

[R] convert to csv file

2010-09-16 Thread lord12
I have a command: write.table(table_list, file= paste(file, x, sep = )) where x is the file name. How do I convert this file into a csv file in this statement? -- View this message in context: http://r.789695.n4.nabble.com/convert-to-csv-file-tp2543232p2543232.html Sent from the R help mailing

Re: [R] convert to csv file

2010-09-16 Thread lord12
I want to open the file in excel and I want the columns in my table to be lined up with the columns in excel. -- View this message in context: http://r.789695.n4.nabble.com/convert-to-csv-file-tp2543232p2543256.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] convert to csv file

2010-09-16 Thread lord12
write.table(table_list, file= paste(file, x, sep = ), sep = ,) My output is still a file object. -- View this message in context: http://r.789695.n4.nabble.com/convert-to-csv-file-tp2543232p2543251.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] convert to csv file

2010-09-16 Thread lord12
In order to use the extension csv, is the syntax: write.table(table_list, file= paste(file, x, sep = ).csv, sep = ,) ? Also I pretty much create a table by doing: table_list= cbind(c1,c2,c3,c4) where c1...c4 are vectors. -- View this message in context:

[R] extracting objects from lists

2010-09-14 Thread lord12
If you have 5 data frames and you append them to a list, how do you access the first data frame, not the first value of the first data frame while iterating in a for loop? list = c(d1,d2,d3,d4,d5) where d1..d5 are dataframes. for(i in 1: length(list)){ print(list[1]) } -- View this message in

[R] for loop help

2010-09-14 Thread lord12
If you have: Name Value A 2 A 3 A 4 B 5 B 6 B7 In R how do you assign one value to the name: A:9 B:18 -- View this message in context: http://r.789695.n4.nabble.com/for-loop-help-tp2539621p2539621.html Sent from the R help

Re: [R] for loop help

2010-09-14 Thread lord12
How do I create a hash table using R? -- View this message in context: http://r.789695.n4.nabble.com/for-loop-help-tp2539621p2539657.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] how to you output a vector to a column in excel?

2010-09-12 Thread lord12
What happens if I want to automate this process for say 500 vectors? -- View this message in context: http://r.789695.n4.nabble.com/how-to-you-output-a-vector-to-a-column-in-excel-tp2530470p2536402.html Sent from the R help mailing list archive at Nabble.com.

[R] outputting arima models

2010-09-11 Thread lord12
sseq - c(1, seq(5, 120, by = 5)) for(i in 1:length(sseq)){ assign(paste(arima, i, sep=), arima0(data.ts[sseq[i]:(sseq[i]+115)], order=c(1,1,1))) } pred1 = predict(arima1, n.ahead = 5, se.fit = TRUE)$pred how do I traverse the arima models so I repeat the above prediction procedure(bold) on all

[R] how to you output a vector to a column in excel?

2010-09-07 Thread lord12
What is the syntax for this? If you have: vector = c(1,2,3,4), how would you output this to column A of an excel spreadsheet? -- View this message in context: http://r.789695.n4.nabble.com/how-to-you-output-a-vector-to-a-column-in-excel-tp2530470p2530470.html Sent from the R help mailing list

Re: [R] R time series analysis

2010-09-07 Thread lord12
For each arima model, can you output an associated confidence interval for the predicted value at each time point? -- View this message in context: http://r.789695.n4.nabble.com/R-time-series-analysis-tp2527513p2530595.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] R time series analysis

2010-09-05 Thread lord12
How do I get the predicted values and the errors for each arima model? -- View this message in context: http://r.789695.n4.nabble.com/R-time-series-analysis-tp2527513p2527533.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] R time series analysis

2010-09-05 Thread lord12
How do you evaluate the predictive models? For example if I have: arima1 = arima(training, order = c(1,1,1)) arima2 = arima(training, order = c(0,0,0)) x.fore = predict(arima1, n.ahead=5) x.fore1 = predict(arima2, n.ahead = 5) How do I know which arima model is better for prediction? --

[R] how do I transform this to a for loop

2010-09-05 Thread lord12
arima1 = arima(data.ts[1:200], order = c(1,1,1)) arima2 = arima(data.ts[5:205], order = c(1,1,1)) arima3 = arima(data.ts[10:210], order = c(1,1,1)) arima4 = arima(data.ts[15:215], order = c(1,1,1)) arima5 = arima(data.ts[20:220], order = c(1,1,1)) arima6 = arima(data.ts[25:225], order = c(1,1,1))