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
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:
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:
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.
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:
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
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
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,
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,
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
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
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
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
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
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
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:
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:
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?
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:
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:
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
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
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
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
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
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.
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
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
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.
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 =
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.
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:
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.
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
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.
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.
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:
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
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
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
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.
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
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
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.
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.
__
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?
--
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))
47 matches
Mail list logo