[R] Reading a list of filenames from a csv file

2013-07-11 Thread Jannetta Steyn
What would be the best way to read a list of filenames and headings from a csv file? The CSV file is structured as two columns, with column one being the filename and column two being a heading e.g.: ANA110915004A_3PERIOD_TmAvg-rdata.csv,Pre-DA ANA110915006A_3PERIOD_TmAvg-rdata.csv,DA-10^-6 ANA110

Re: [R] Error in read.table

2013-07-11 Thread Jannetta Steyn
I'll post the rephrasing of the question as a new thread. I hope that is okay. On 11 July 2013 13:40, Jannetta Steyn wrote: > > > Maybe I should rephrase my question. What would be the best way to read a > list of filenames and headings from a csv file? > > The CSV fi

[R] Fwd: Error in read.table

2013-07-11 Thread Jannetta Steyn
l 11, 2013, at 13:50 , Dante.py wrote: > > > Maybe you should set parameter "as.is" in read.csv to be false. > > TRUE more likely... However, there's another issue: files[i,] is a data > frame, therefore so is f[1] (a telltale sign is that it has rows and column > labe

[R] Error in read.table

2013-07-11 Thread Jannetta Steyn
Hi Folks I can't see what I have done wrong in this piece of code. # Read filenames from csv file files <- read.csv(file="files.csv",head=FALSE,sep=",") # for each filename read the file for (i in 1:length(files)) { # f becomes the next row inthe file f<-files[i,] # the header to be used f

Re: [R] R and MatLab implementations of the same model differs

2013-07-05 Thread Jannetta Steyn
Aah. Thanks. I remember someone mentioned a named vector and I meant to ask what that was, but I forgot. I have now fixed it. On 5 July 2013 17:18, Berend Hasselman wrote: > > On 05-07-2013, at 17:37, Jannetta Steyn wrote: > > > Thank you very much to all of you for your help.

Re: [R] R and MatLab implementations of the same model differs

2013-07-05 Thread Jannetta Steyn
nd both model now produce similar results :-) Regards Jannetta On 5 July 2013 12:11, Jannetta Steyn wrote: > > > > On 5 July 2013 09:44, Berend Hasselman wrote: > >> >> On 05-07-2013, at 09:53, Jannetta Steyn wrote: >> >> > >> > >> &

Re: [R] R and MatLab implementations of the same model differs

2013-07-05 Thread Jannetta Steyn
On 5 July 2013 09:44, Berend Hasselman wrote: > > On 05-07-2013, at 09:53, Jannetta Steyn wrote: > > > > > > > > > > > I don't quite know how to explain the "doesn't work" in more detail > without > > > any visual aid. &

Re: [R] R and MatLab implementations of the same model differs

2013-07-04 Thread Jannetta Steyn
Hi All Thanks for all the comments. I have looked at everything you have pointed out and this is the situation at the moment: > I don't think so. > In the R script you have > > init = c(v_axon_AB=-55,mNa_axon_AB=1,hNa_axon_AB=0,mK_axon_AB=1) > > That is not the same as in your Matlab script. To m

Re: [R] R and MatLab implementations of the same model differs

2013-07-04 Thread Jannetta Steyn
s to posts? I'll try. The flatline image is the plot from MatLab and the other is the plot from R. Thanks Jannetta On 4 July 2013 16:52, Ben Bolker wrote: > Berend Hasselman xs4all.nl> writes: > > > > > > > On 04-07-2013, at 17:15, Jannetta Steyn henning.org>

[R] R and MatLab implementations of the same model differs

2013-07-04 Thread Jannetta Steyn
Hi folks I have implemented a model of a neuron using Hodgkin Huxley equations in both R and MatLab. My preference is to work with R but R is not giving me the correct results. I also can't use ode45 as it just seems to go into an indefinite loop. However, the MatLab implementation work fine with

Re: [R] object not found

2013-06-02 Thread Jannetta Steyn
On Sat, Jun 1, 2013 at 8:50 PM, Jannetta Steyn wrote: > >> Hi All >> >> I am trying to implement a neural model in R from a paper but I have run >> into a bit of a problem. The model is getting so complex that I can't >> really test it in bits any more. At the mo

[R] object not found

2013-06-01 Thread Jannetta Steyn
Hi All I am trying to implement a neural model in R from a paper but I have run into a bit of a problem. The model is getting so complex that I can't really test it in bits any more. At the moment I get this error: Error in eval(expr, envir, enclos) : object 'mCaT_soma_AB' not found I think I hav

[R] Error in J[time] : invalid subscript type 'closure'

2013-02-24 Thread Jannetta Steyn
Hi All I have Googled the message Error in J[time] : invalid subscript type 'closure', but can't quite make sense from the results that I get. What does it mean? I'm trying to access an element in an array. Here is a short bit of code that produces the error: s_fun <- function(parms,time) { w

Re: [R] filling an array

2013-02-24 Thread Jannetta Steyn
gt; rep(c(0, v), each = 10) > > See ?rep for details > > Cheers, > > Josh > > > On Sat, Feb 23, 2013 at 7:56 PM, Jannetta Steyn > wrote: > > Hi All > > > > I'm just wondering if there is a quick way of filling a way with the > > following.

[R] filling an array

2013-02-23 Thread Jannetta Steyn
Hi All I'm just wondering if there is a quick way of filling a way with the following. I want to declare array I with a specific length and then alternatively fill it with 10 zeros and 10 specified values: v<- 14 I <- c(0,length(t)) But in stead of just filling I with 0 I want 10 zeros and the

[R] using and event in deSolve

2013-02-21 Thread Jannetta Steyn
Hi All Having been pointed the use of events and roots in deSolve, I was able to implement the Izchikevich model of spiking neurons. However, I'm not too sure of defining the event. The deSolve documentation says: An event is triggered when the ball hits the ground (height = 0) Then velocity (y2)

[R] attempt to apply non-function

2013-02-18 Thread Jannetta Steyn
Hi All I am getting the above mentioned error when I run the code below. I don't know why because I have implemented the function and I'm calling the function with a parameter. I'm obviously missing the plot ... Can someone perhaps point out the error of my ways? Error: > out<-ode(y=init, times=t

Re: [R] An extended Hodgkin-Huxley model that doesn't want to work.

2013-02-15 Thread Jannetta Steyn
:41, Berend Hasselman wrote: > > Forgot Reply to All. > > On 13-02-2013, at 23:30, Jannetta Steyn wrote: > > > Hi All > > > > I have been struggling with this model for some time now and I just can't > > get it to work correctly. The messages I get when ru

Re: [R] An extended Hodgkin-Huxley model that doesn't want to work.

2013-02-15 Thread Jannetta Steyn
oma, parms=parms); plot(ode) o<-data.frame(out); plot(o$time, o$v, type='l'); Regards Jannetta On 15 February 2013 09:46, Berend Hasselman wrote: > > On 15-02-2013, at 10:28, Jannetta Steyn wrote: > > > Hi Ben > > > > Thank you so much for spending the time

Re: [R] An extended Hodgkin-Huxley model that doesn't want to work.

2013-02-15 Thread Jannetta Steyn
Sorry that was supposed to be Berend and not Ben On 15 February 2013 09:28, Jannetta Steyn wrote: > Hi Ben > > Thank you so much for spending the time to look at my code. I really > appreciate it. > > The unnecessary parameters were artefacts from me working on the model an

[R] An extended Hodgkin-Huxley model that doesn't want to work.

2013-02-13 Thread Jannetta Steyn
Hi All I have been struggling with this model for some time now and I just can't get it to work correctly. The messages I get when running the code is: DLSODA- Warning..Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size). Solver will c

Re: [R] A Hodgkin Huxley Model

2013-02-10 Thread Jannetta Steyn
2013 00:09, David Winsemius wrote: > > On Feb 10, 2013, at 3:35 PM, Jannetta Steyn wrote: > > I managed to get it to work (I think). Code below: >> >> > The output certainly looks more sensible. You commented out the if-reset > strategy and are using events. Can you

Re: [R] A Hodgkin Huxley Model

2013-02-10 Thread Jannetta Steyn
I managed to get it to work (I think). Code below: library(deSolve); Izhikevich <- function(time, init, parms) { with(as.list(c(init, parms)),{ dv <- (0.04*v^2)+(5*v)+140-u+I; du <- a*(b*v-u); #if (v>=30) v<-c else v<-u+d; list( c(dv, du)) })} parms=c( a=0.02, b=0.2, c=-65, d=2

[R] A Hodgkin Huxley Model

2013-02-10 Thread Jannetta Steyn
Hi All It has been suggested to me that the folks in this list might be able to help me out of my misery. As part of my learning curve to building a rather detailed model of a small neurone complex I am implementing some existing models in R. For the moment I want to implement the Izhikevich mod