Append to neuronlist with rbind()?

35 views
Skip to first unread message

Shruthi Ravindranath

unread,
Jun 14, 2019, 8:05:38 PM6/14/19
to nat-user
Hello, 

I have a collection of neurons in .swc format registered to the same template brain. I want to read them all into a common neuronlist to facilitate plotting and other common operations on this data frame. Is this possible to do using read.neuron() and the R function rbind()? 

I tried this with no success:
all_nlist <- read.neuron(fw_neurons[1]) #fw_neuron is a list containing the paths to my .swc files of interest
for (f in fw_neurons[2:length(fw_neurons)]) {n1 = read.neuron(f) 
all_nlist <- rbind(all_nlist, n1)
}
When I try plot3d() with the above all_nlist I get errors that look like this:
In xyz.coords(x, y, z, xlab = xlabel, ylab = ylabel, zlab = zlabel,  ... :
  NAs introduced by coercion


Thanks for the help, 
Shruthi

Gregory Jefferis

unread,
Jun 14, 2019, 9:02:41 PM6/14/19
to Shruthi Ravindranath, nat-user
Thanks for your question. Please use read.neurons to read in multiple skeletons to a single neuronlist object. If you had to combine multiple neuronlist objects manually you would use c(), which is the standard r way to concatenate lists and vectors. 

Can I suggest reading this article with worked examples 


I think it will repay the time investment. 

Best wishes,

Greg.

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "nat-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nat-user+u...@googlegroups.com.
Visit this group at https://groups.google.com/group/nat-user.
To view this discussion on the web, visit https://groups.google.com/d/msgid/nat-user/4e302d53-44b9-4d60-81c1-44988c3895f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shruthi Ravindranath

unread,
Jun 17, 2019, 2:36:13 PM6/17/19
to nat-user
Thanks a lot for the help. read.neurons() works well for my purpose.


On Friday, June 14, 2019 at 9:02:41 PM UTC-4, Gregory Jefferis wrote:
Thanks for your question. Please use read.neurons to read in multiple skeletons to a single neuronlist object. If you had to combine multiple neuronlist objects manually you would use c(), which is the standard r way to concatenate lists and vectors. 

Can I suggest reading this article with worked examples 


I think it will repay the time investment. 

Best wishes,

Greg.

Sent from my iPhone

On 15 Jun 2019, at 01:05, Shruthi Ravindranath <shruthi.ra...@gmail.com> wrote:

Hello, 

I have a collection of neurons in .swc format registered to the same template brain. I want to read them all into a common neuronlist to facilitate plotting and other common operations on this data frame. Is this possible to do using read.neuron() and the R function rbind()? 

I tried this with no success:
all_nlist <- read.neuron(fw_neurons[1]) #fw_neuron is a list containing the paths to my .swc files of interest
for (f in fw_neurons[2:length(fw_neurons)]) {n1 = read.neuron(f) 
all_nlist <- rbind(all_nlist, n1)
}
When I try plot3d() with the above all_nlist I get errors that look like this:
In xyz.coords(x, y, z, xlab = xlabel, ylab = ylabel, zlab = zlabel,  ... :
  NAs introduced by coercion


Thanks for the help, 
Shruthi

--
You received this message because you are subscribed to the Google Groups "nat-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nat-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages