Displaying 20 results from an estimated 5000 matches similar to: "Import multiple data frames and combine them using "cbind""
2011 Nov 09
2
Error in drawing
I have got following error in drawing wavelet fitting. can some one help?
> library(faraway)
> data(lidar)
> newlidar<-lidar[c(1:128),]
> library(wavethresh)
> wds <- wd(newlidar$logratio)
> draw(wds)
Error in plot.default(x = x, y = zwr, main = main, sub = sub, xlab = xlab,
:
formal argument "type" matched by multiple actual arguments
[[alternative HTML
2011 Nov 29
3
Problem in log
Hi all I have a function of log defined by y = log(1- exp(-a)), when
exp(-a) is greater, 1, it produce NaN. How can I remove this in R?
[[alternative HTML version deleted]]
2011 Nov 07
3
Correction in error
Hello R community, following is my code and it shows error, can some one
fix this error and explain why this occurs?
gibbs <-function(m,n, theta = 0, lambda = 1){
alpha <- 1.5
beta <- 1.5
gamma <- 1.5
x<- array(0,c(m+1, 3))
x[1,1] <- theta
x[1,2] <- lambda
x[1,3]<- n
for(t in 2:m+1){
x[t,1] <- rbinom(x[t-1,3], 1, x[t-1,1])
2012 Apr 06
2
Bayesian 95% Credible interval
Hi all,
I have the data from the posterior distribution for some parameter. I want
to find the 95% credible interval. I think "t.test(data)" is only for the
confidence interval. I did not fine function for the Bayesian credible
interval. Could some one suggest me?
Thanks
[[alternative HTML version deleted]]
2011 Nov 18
3
Permutations
Hi all,
why factorial(150) shows the error out of range in 'gammafn'?
I have to calculate the number of subset formed by 150 samples taking 10 at
a time. How is this possible?
best
[[alternative HTML version deleted]]
2011 Nov 16
2
Error in random walk Metroplis-hasting
Hi R community,
I have some data set and construct the likelihood as follows
likelihood <- function(alpha,beta){
lh<-1
d<-0
p<-0
k<-NULL
data<-read.table("epidemic.txt",header = TRUE)
attach(data, warn.conflicts = F)
k <-which(inftime==1)
d <- (sqrt((x-x[k])^2+(y-y[k])^2))^(-beta)
p<-1 - exp(-alpha*d)
for(i in 1:100){
2011 Nov 21
1
Sub sets
I'd appreciate it if you'd keep on list for the archives. That said, I
think this function does what you were hoping for.
Michael
powerset <- function(n, items = NULL){
if(!is.null(items)) {
if(n != length(items)) warning("Resetting n in preference to
length(items)")
n = length(items)
}
smat <- do.call(expand.grid, rep(list(c(0,1)), n))
2011 Nov 08
3
GAM
Hi R community!
I am analyzing the data set "motorins" in the package "faraway" by using
the generalized additive model. it shows the following error. Can some one
suggest me the right way?
library(faraway)
data(motorins)
motori <- motorins[motorins$Zone==1,]
library(mgcv)
>amgam <- gam(log(Payment) ~ offset(log(Insured))+
s(as.numeric(Kilometres)) + s(Bonus) + Make +
2012 Oct 22
1
random forest
Hi all,
Can some one tell me the difference between the following two formulas?
1. epiG.rf <-randomForest(gamma~.,data=data, na.action = na.fail,ntree =
300,xtest = NULL, ytest = NULL,replace = T, proximity =F)
2.epiG.rf <-randomForest(gamma~.,data=data, na.action = na.fail,ntree =
300,xtest = NULL, ytest = NULL,replace = T, proximity =F)
[[alternative HTML version deleted]]
2011 Nov 18
1
Permutation matrix
Hi all,
I have a set of elements (1, 1, 0,1,1,0,1,0,1,1) with ten elements. I have
to construct the permutation matrix of this set which is of the size 10 by
2^10. Can some one help how is this possible? Is there is a particular
function in R or I need to make function?
Best
[[alternative HTML version deleted]]
2011 Dec 05
1
Problem in while loop
Hi all,
I have the following code,
When I run the code, it never terminate this is because of the while loop i
am using. In general, if you need a loop for which you don't know in
advance how many iterations there will be, you can use the `while'
statement so here too i don't know the number how many iterations are
there. So Can some one suggest me whats going on?
I am using the
2012 Oct 01
1
Problem with nls regression fit
Hi all,
I got following problem in fitting the data.
Any kind of suggestions are welcome
> beta <- 3.5
> d <- seq(0.1,62.5,0.1)
> y <- exp(-beta*d)
> y1 <- y
> x <- read.table("epidist.txt", header = TRUE)
> data.nls <- as.data.frame(cbind(y1,x))
> #attach(data.nls)
> nls.fit <- nls(y1~dist,data.nls)
Error in cll[[1L]] : object of type
2011 Jun 27
2
Executing the same function on consecutive files
Hi all,
I have the next problem: I have a matrix with size 8,000,000x18. My personal
computer...blocks...so I have cut my original file into 100 different file.
I have written a function that should be run on each of this file.
So imagine
I need to read data from q1 to q100 file
data<-read.table("q1.txt",sep="")
and each time I read 1 file execute my personal function
2011 Jan 21
2
Looping with incremented object name and increment function
Folks,
I am trying to get a loop to run which increments the object name as part of
the loop. Here "fit1" "fit2" "fit3" and "fit4" are linear regression models
that I have created.
> for (ii in c(1:4)){
+ SSE[ii]=rbind(anova(fit[ii])$"Sum Sq")
+ dfe[ii]=rbind(summary(fit[ii])$df)
+ }
Error in anova(fit[ii]) : object 'fit' not found
2011 Oct 14
3
Split a list
I have a list of dataframes i.e. each list element is a dataframe with three columns and differing number of rows. The third column takes on only two values. I wish to split the list into two sublists based on the value of the third column of the list element.
Second issue with lists as well. I would like to reduce each of the sublist based on the range of the second column, i.e. if the range of
2011 Jan 17
2
Summing data frame columns on identical data
Dear all,
I have 9 data frames, and I'm simply trying to sum the values of column 3 (on a row-by-row basis). However, there are a slightly different number of rows in each data frame, so I'm receiving the following error: "Error in Ops.data.frame(mrunoff_207101[3], mrunoff_207102[3]) :
? + only defined for equally-sized data frames".
Here is what I'm attempting to do:
2011 Mar 06
2
How to load load multiple text files and order by id
Hello R users,
I am fairly new to R and was hoping you could point me in the right
direction I have a set of text files (36).
Each file has only two columns (id and count) , I am trying to figure out a
way to load all the files together and
then have them ordered by id into a matrix data frame. For example
If each txt file has :
ID count
id_00002 20
id_00003 3
A Merged File:
ID
2012 Feb 10
6
Importing a CSV file
I have been trying to import a csv file to r. but I get the same message everytime. the message is
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'Users:/sezginozcan/Downloads/beer.data.csv': No such file or directory
I use mac.
I tried this command also
2011 Nov 26
2
simplify source code
Hi
I would like to shorten
mod1 <- nls(ColName2 ~ ColName1, data = table, ...)
mod2 <- nls(ColName3 ~ ColName1, data = table, ...)
mod3 <- nls(ColName4 ~ ColName1, data = table, ...)
...
is there something like
cols = c(ColName2,ColName3,ColName4,...)
for i in ...
mod[i-1] <- nls(ColName[i] ~ ColName1, data = table, ...)
I am looking forward to help
Christof
2011 May 23
6
Reading Data from mle into excel?
Hi there,
I ran the following code:
vols=read.csv(file="C:/Documents and Settings/Hugh/My Documents/PhD/Swaption
vols.csv"
, header=TRUE, sep=",")
X<-ts(vols[,2])
#X
dcOU<-function(x,t,x0,theta,log=FALSE){
Ex<-theta[1]/theta[2]+(x0-theta[1]/theta[2])*exp(-theta[2]*t)
Vx<-theta[3]^2*(1-exp(-2*theta[2]*t))/(2*theta[2])
dnorm(x,mean=Ex,sd=sqrt(Vx),log=log)
}