5 Replies - 558 Views - Last Post: 11 June 2017 - 01:22 PM Rate Topic: -----

#1 cs94  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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)
summary(Boston$rad)
unique(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)
far <- ifelse(Boston$rad <-24,1,0)




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  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13485
  • View blog
  • Posts: 53,847
  • 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?
Was This Post Helpful? 0
  • +
  • -

#3 cs94  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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?
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13485
  • View blog
  • Posts: 53,847
  • Joined: 12-June 08

Re: Help with R Programming

Posted 11 June 2017 - 01:01 PM

#3.
Was This Post Helpful? 0
  • +
  • -

#5 cs94  Icon User is offline

  • New D.I.C Head

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

Re: Help with R Programming

Posted 11 June 2017 - 01:10 PM

View Postmodi123_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)
summary(Boston$rad)
unique(Boston$rad)
radius <- Boston$rad
sum(radius <- 24)



Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13485
  • View blog
  • Posts: 53,847
  • Joined: 12-June 08

Re: Help with R Programming

Posted 11 June 2017 - 01:22 PM

I do not understand that post.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1