Hi, a good start is to verify that what you have read meets your
expectations. Try
str(data1)
dim(data1)
print(data1)
and make sure you read ?read.table. There are plenty of *arguments* that
affects the way R reads your data text file.
/Henrik
Wagle, Mugdha wrote:> Hi,
>
> The file I am reading is a text file, whose contents are a matrix that has
15 rows and 58 columns. The first row has column names, and the first column has
row names, so the format is correct as far as using read.table is concerned. The
other values in the table are all float values (numeric). So when I read in the
file using data1 <- read.table("HAL001_HAL0015_Signals.txt"), it
gets read in as a table, but when I try to manipulate an individual value as
follows: data1[2 ,2] <- log(data1[2 ,2]+20) , I get the "object is not
subsettable" message. This error occurs when I use R only...Perl is not
being used at this point. My script needs to take input from an HTML page (using
a CGI interface) which will be the name of the file to be passed onto R as a
table. Since read.table isn't working within R itself, I haven't used it
for the function call from Perl to R yet. Instead, I have been making repeated
function calls using a loop in Perl, to access other R and Bioconductor fun
ct!> ions that I need such as t.test and ANOVA. This is very time-consuming,
however. I am working in a Linux environment, and using
> R 2.1.0
>
> Thanks for any help and suggestions!
>
> Mugdha Wagle
>
> ________________________________
>
> From: Sean Davis [mailto:sdavis2 at mail.nih.gov]
> Sent: Fri 6/3/2005 8:03 AM
> To: Wagle, Mugdha
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] reading tables into R. .
>
>
>
>
> On Jun 3, 2005, at 8:40 AM, Wagle, Mugdha wrote:
>
>
>>I have been using R and Perl. When I read in a text file using the
>>read.table option, and I try to mathematically manipulate the
>>individual elements in the table, I keep getting an "object is not
>>subsettable" error. If I try to use a different method, it works,
but
>>takes too much time(basically, I then need to read in values
>>individually into R instead of as a 2D array, so the number of
>>function calls from Perl to R is very large). Could you suggest
>>another method whereby I could read an entire matrix or a file using
>>an R function call?
>>
>
>
> Mugdha,
>
> I think you will probably have to be more specific. Could you give an
> example of the data format, the commands you used to load it that
> didn't work, and those that did and explain how perl comes into this?
> Also, knowing what OS and version of R you are using is quite helpful.
>
> Sean
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>
>