[R] problem in R

Sarah Goslee sarah.goslee at gmail.com
Fri Feb 20 16:04:41 CET 2015


Hi,

On Fri, Feb 20, 2015 at 9:48 AM, thanoon younis
<thanoon.younis80 at gmail.com> wrote:
> Dear all members
>
> I have the following matrix in R
>
>> thd <- matrix(testJAGSdata$thd, ncol=6, byrow=TRUE)
>> head(thd)
>      [,1]   [,2]   [,3]   [,4]  [,5] [,6]
> [1,] -200 -2.517 -1.245 -0.444 0.848  200
> [2,] -200 -1.447 -0.420  0.119  1.245 200
> [3,] -200 -1.671 -0.869 -0.194  0.679 200
> [4,] -200 -1.642 -0.869 -0.293  0.332 200
> [5,] -200 -1.671 -0.827  0.052  0.756 200
> [6,] -200 -1.769 -1.098 -0.469  0.255 200
> [7,] -200 -1.490 -0.670 -0.082  0.880 200
> [8,] -200 -1.933 -0.880 -0.317  1.008 200
> [9,] -200  -1.587 -0.624  0.000  1.008 200
> [10,] -200 -1.983 -1.348 -0.348  1.045 200
> [11,] -200 -1.983 -1.229 -0.247  0.869 200
> [12,] -200 -2.262 -1.426  0.037  1.330 200
> [13,] -200 -2.371 -1.295 -0.224  0.651 200
> [14,] -200 -2.039 -1.112 -0.149  1.169 200
> [15,] -200 -2.262 -1.198 -0.309  1.198 200
> [16,] -200 -2.176 -1.537 -0.717  0.597 200
> [17,] -200 -1.447 -0.786  0.119  1.008 200
> [18,] -200 -2.039 -1.769 -0.661  0.642 200

This is not reproducible, so the below are guesses.

> and when i implemented this matrix i found this error

I have no idea what "implemented this matrix" might mean.

>
> + > head(the)

First problem: the + means R expects continuation of a previous line,
because the command is incomplete. So whatever you did BEFORE this
line is wrong.

> +      [,1]   [,2]   [,3]   [,4]  [,5] [,6]
> + [1,] -200 -2.517 -1.245 -0.444 0.848  200
> Error: unexpected numeric constant in:
> "     [,1]   [,2]   [,3]   [,4]  [,5] [,6]
> [1,] -200 -2.517 -1.245 -0.444 0.848"

These and subsequent errors are what you'd get if you pasted the above
R output back into the R console. Why would you do that?

So: check your previous commands.
If you can't find your mistake, respond to the list with a clear
reproducible example.

>> [2,] -200 -1.447 -0.420  0.119  1.245 200
> Error: unexpected '[' in "["
>> [3,] -200 -1.671 -0.869 -0.194  0.679 200
> Error: unexpected '[' in "["
>> [4,] -200 -1.642 -0.869 -0.293  0.332 200
> Error: unexpected '[' in "["
>> [5,] -200 -1.671 -0.827  0.052  0.756 200
> Error: unexpected '[' in "["
>> [6,] -200 -1.769 -1.098 -0.469  0.255 200
> Error: unexpected '[' in "["
>> [7,] -200 -1.490 -0.670 -0.082  0.880 200
> Error: unexpected '[' in "["
>> [8,] -200 -1.933 -0.880 -0.317  1.008 200
> Error: unexpected '[' in "["
>> [9,] -200  -1.587 -0.624  0.000  1.008 200
> Error: unexpected '[' in "["
>> [10,] -200 -1.983 -1.348 -0.348  1.045 200
> Error: unexpected '[' in "["
>> [11,] -200 -1.983 -1.229 -0.247  0.869 200
> Error: unexpected '[' in "["
>> [12,] -200 -2.262 -1.426  0.037  1.330 200
> Error: unexpected '[' in "["
>> [13,] -200 -2.371 -1.295 -0.224  0.651 200
> Error: unexpected '[' in "["
>> [14,] -200 -2.039 -1.112 -0.149  1.169 200
> Error: unexpected '[' in "["
>> [15,] -200 -2.262 -1.198 -0.309  1.198 200
> Error: unexpected '[' in "["
>> [16,] -200 -2.176 -1.537 -0.717  0.597 200
> Error: unexpected '[' in "["
>> [17,] -200 -1.447 -0.786  0.119  1.008 200
> Error: unexpected '[' in "["
>> [18,] -200 -2.039 -1.769 -0.661  0.642 200
> Error: unexpected '[' in "["
>
>
> Any help would be very appreciated
>
> thanks in advance
> --
> Thanoon Y. Thanoon
> PhD Candidate
> Department of Mathematical Sciences
> Faculty of Science
> University Technology Malaysia, UTM
> E.Mail: Thanoon.younis80 at gmail.com
> E.Mail: dawn_prayer80 at yahoo.com
> Facebook:Thanoon Younis AL-Shakerchy
> Twitter: Thanoon Alshakerchy
> H.P:00601127550205
>

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list