Re: [R] Using NULL to my data?

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Mon, 09 May 2011 12:47:11 -0400

You certainly can't assign a character string into a numeric column. There is no reason to expect that to work.

Can you provide some clarity on what the problem is in terms of a very small self contained example explaining what you get and what you expected to get.

Regards.

On Mon, May 9, 2011 at 12:40 PM, Nilza BARROS <nilzabarros_at_gmail.com> wrote:
> Dear Ruser,
>
> Thank for your help.
> I've just tried the command below and it works
> Alldados[is.na(Alldados)]<-"NULL"
>
> But I am facing other problem, since I need to format my data before feeding
> my database.
>  I am using the command below:
>
> with(Alldados,sprintf("INSERT INTO OBS
> (date,T_2M,TMAX_2M,TMIN_2M,TD_2M,PS,FF_10M,DD_10M,TOT_PRCP,CLCL,Station_NO)
> VALUES (%s, %5.2f, %5.2f, %5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%5.2f,%s)",
>
> date2,T_2M,TMAX_2M,TMIN_2M,TD_2M,PS,FF_10M,DD_10M,TOT_PRCP,CLCL,Station_NO))
>
> But it is not working anymore. Because now the same field can be numeric or
> character.
> How can I use the format command above the allow it.
>
> I really appreciate any help.
> Nilza
>
>
>
>
>
> On Mon, May 9, 2011 at 12:55 PM, David Winsemius <dwinsemius_at_comcast.net>wrote:
>
>>
>> On May 9, 2011, at 10:07 AM, Nilza BARROS wrote:
>>
>> Dear R users,
>>>
>>> I am reading data from a file where there are some missing that are
>>> represented by -9999.00.
>>> I am using the command below.
>>> =====My original data ===========
>>>
>>> PARM = TMPC;T12X;T12N;DWPC;PALT;SKNT;DRCT;P24M;CLCL
>>>
>>
>> snipped
>>
>>
>> But  I need to feed my database. These missings should be represented by
>>> NULL.
>>> I mean, all "NA" should be replaced by "NULL" in my database.
>>>
>>
>> Do you mean a string that is spelled "NULL"
>>
>> If so, try:
>>
>> dfrm[is.na(dfrm)] <- "NULL"
>>
>>
>> I am trying the command below to pick up the rows and columns with NA but I
>>> don't know how to fill the original data :
>>>
>>> which(is.na(Alldados),arr.ind=TRUE)
>>>
>>> But I don't know how to replace each NA with NULL. I tried using as.null
>>> but
>>> NA is not replace at all.
>>>
>>
>> If you set a column of a data.frame to NULL , it will erase it.
>>
>>
>>
>>> I hope someone could help me.
>>>
>>> Best Wishes,
>>> Nilza Barros
>>>
>>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>>
>
>
> --
> Abraço,
> Nilza Barros
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 09 May 2011 - 16:50:20 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 09 May 2011 - 17:10:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive