# Help with R Programming

Page 1 of 1

## 5 Replies - 734 Views - Last Post: 11 June 2017 - 01:22 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=404543&amp;s=f47f487f20af6042af0a5ac089d4a4e3&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 cs94

Reputation: 0
• Posts: 3
• Joined: 11-June 17

# Help with R Programming

Posted 11 June 2017 - 12:32 PM

I am using the R database in R studio

1) Explore the rad variable. What kind of variable is rad? What information do you get about this variable with the summary() function? Does the unique() function give you additional information? Use the sum() function to determine how many neighborhoods have rad equal to 24. Use R code to determine what percentage this is of the neighborhoods.

I think I got everything but the sum() function can you please tell me how do I do it?

Here is what I have so far.

```typeof(Boston\$rad)

```

2) Create a new variable called “far” using the ifelse() function that is TRUE if rad is 24 and false otherwise. Make the variable a factor. Plot far and medv. What does the graph tell?

```far<- as.factor(far)

```

I know this is not right. Error: Error in is.factor(x) : object 'far' not found

3) 10. Create a summary of Boston just for columns 1, 6, 13 and 14 (crim, rm, lstat, medv). Use the which() function to find the neighborhood with the highest median value. Display that row from the data set, but only colums 1, 6, 13 and 14. Write a few sentences comparing this neighborhood and the city as a whole in terms of: crime, number of rooms, lower economic percent, median value.

This is what I have so far:

```summary(Boston\$crim)
summary(Boston\$rm)
summary(Boston\$lstat)
summary(Boston\$medv)

which(Boston\$)

```

Thank you!

Is This A Good Question/Topic? 0

## Replies To: Help with R Programming

### #2 modi123_1

• Suitor #2

Reputation: 13952
• Posts: 55,691
• Joined: 12-June 08

## Re: Help with R Programming

Posted 11 June 2017 - 12:44 PM

Quote

the sum() function can you please tell me how do I do it?

What have you tried or considered?

```1	far<- as.factor(far)
```

'far' is just being declared there, right? How would it be used if it wasn't declared yet and then assigned to itself?

Quote

This is what I have so far:

What is the question there?

### #3 cs94

Reputation: 0
• Posts: 3
• Joined: 11-June 17

## Re: Help with R Programming

Posted 11 June 2017 - 12:56 PM

Quote

This is what I have so far:

What is the question there?
[/quote]

What number are you talking about?

### #4 modi123_1

• Suitor #2

Reputation: 13952
• Posts: 55,691
• Joined: 12-June 08

## Re: Help with R Programming

Posted 11 June 2017 - 01:01 PM

#3.

### #5 cs94

Reputation: 0
• Posts: 3
• Joined: 11-June 17

## Re: Help with R Programming

Posted 11 June 2017 - 01:10 PM

modi123_1, on 11 June 2017 - 01:01 PM, said:

#3.

Quote

Use the which() function to find the neighborhood with the highest median value. Display that row from the data set, but only colums 1, 6, 13 and 14. Write a few sentences comparing this neighborhood and the city as a whole in terms of: crime, number of rooms, lower economic percent, median value.

[quote name='modi123_1' date='11 June 2017 - 12:44 PM' timestamp='1497210295' post='2325473']

Quote

the sum() function can you please tell me how do I do it?

What have you tried or considered?

Quote

1) Explore the rad variable. What kind of variable is rad? What information do you get about this variable with the summary() function? Does the unique() function give you additional information? Use the sum() function to determine how many neighborhoods have rad equal to 24. Use R code to determine what percentage this is of the neighborhoods.
```typeof(Boston\$rad)

```

### #6 modi123_1

• Suitor #2

Reputation: 13952
• Posts: 55,691
• Joined: 12-June 08

## Re: Help with R Programming

Posted 11 June 2017 - 01:22 PM

I do not understand that post.