Question: I have a sample dataset 'a' like this:

```
> a
  group marks  upd class
1     T     2   up     A
2     C     3   up  <NA>
3     C     4 down     B
4     T     5   up  <NA>
5     T     6 down     D
6     C     7   up  <NA>
7     T     1 down  <NA>
8     T     0 down     G

```

Here for each group (T or C) there are records in 'class' variable with values and null. Now for each group where ever the class is null ,I want that group to be renamed as T-NULL or C-NULL respectively. If the group (T or c) has some value in 'class' ,the group name should be as it is. How can we write a code in R for this?

Answer: 
Your `id.value` is not a HTML element. You are trying to get an access to `value` property of id variable... Something like this `"ename".value`

Try this:

```
document.getElementById(id).value = 'VALUE';

```

```js
function myFunction(id) {

  var x = parseInt(document.getElementById(id).value);

  if (!(x === parseInt(x, 10))) {

    alert("Empployee ID can be integer numbers only.");
    document.getElementById(id).value = "";
  } 
  else {

  }
}
```

```html
<div class="header1">
  <input type="text" id="ename" onblur="myFunction('ename')" name="name"  placeholder="Enter Employee ID" required="" />
</div>
```
You are setting empty string in the value property of `id`. `id` is a `string`. Hence, it won't work you need to put an empty string somewhere in the document where the id attribute is equal to the function argument.

you need to use : 

```
document.getElementById(id).value = "";

```