<p>I have a very big matrix I want to put colnames as cell1, cell2, et,.. but I get error</p>
<pre><code>&gt; colnames(new.dat)
NULL
&gt; View(new.dat)
&gt; dim(new.dat)
[1]     34 263086
&gt; colnames(new.dat)=make.names(c(1: 263086, &quot;cell&quot;))
Error in dimnames(x) &lt;- dn : 
  length of 'dimnames' [2] not equal to array extent
&gt; colnames(new.dat) &lt;- paste0(&quot;cell&quot;, seq_along(new.dat))
Error in dimnames(x) &lt;- dn : 
  length of 'dimnames' [2] not equal to array extent
&gt; 
</code></pre>
<p><a href="https://i.sstatic.net/0RXFO.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0RXFO.jpg" alt="enter image description here" /></a></p>
<p>any help?</p>

<r>
Making colnames by number and character
# Making colnames by number and character

(Asked by: username_0 on 2021-06-24)

I have a very big matrix I want to put colnames as cell1, cell2, et,.. but I get error
> colnames(new.dat)
NULL
> View(new.dat)
> dim(new.dat)
[1]     34 263086
> colnames(new.dat)=make.names(c(1: 263086, "cell"))
Error in dimnames(x) <- dn : 
  length of 'dimnames' [2] not equal to array extent
> colnames(new.dat) <- paste0("cell", seq_along(new.dat))
Error in dimnames(x) <- dn : 
  length of 'dimnames' [2] not equal to array extent
> 


any help?

**Tags:** r

---

## 0 answers

