A community for students.
Here's the question you clicked on:
 0 viewing
TranceNova
 3 years ago
Anyone use R for data manipulation?
I'm trying to get a subset and struggling with my code...
(basically I'm trying to select stuff based on different values in different columns, but I just don't know how to word it).
TranceNova
 3 years ago
Anyone use R for data manipulation? I'm trying to get a subset and struggling with my code... (basically I'm trying to select stuff based on different values in different columns, but I just don't know how to word it).

This Question is Closed

mcnalljj
 3 years ago
Best ResponseYou've already chosen the best response.0You'd likely be better off asking this in the CompSci section of the site. And it'd be good to include some source code and data.

FoolForMath
 3 years ago
Best ResponseYou've already chosen the best response.0R is good for data manipulation?

TranceNova
 3 years ago
Best ResponseYou've already chosen the best response.1Yeah I suspected that, I just figured I'd wait to see if anyone used R. Programmers don't really use R do they? And yepp!

FoolForMath
 3 years ago
Best ResponseYou've already chosen the best response.0I have never used R and nor I am looking forward to using it ... btw what about sql or my sql?

TranceNova
 3 years ago
Best ResponseYou've already chosen the best response.1Haven't used sql/my sql before. Nah don't worry R is VERY useful does take some learning but way better than excel once you learn it

mcnalljj
 3 years ago
Best ResponseYou've already chosen the best response.0use nested if statements that cycle through your data and break if a requirement isn't met?

TranceNova
 3 years ago
Best ResponseYou've already chosen the best response.1Thanks for your help, I think I will have to come back to this later when my brain is working a little better, I've been trying to type a description of what I am trying to do and not getting anywhere!

mcnalljj
 3 years ago
Best ResponseYou've already chosen the best response.0while(!eof) //while you haven't reached the end of the file (eof) if (mindate<x<maxdate) { next if } else { break;} } Something like that, I'm not at all familiar with R, I'm more into OOP and functional languages. But, I was meant to study it at one point. As I said give some code and a description of what you want, and I'll try give some pointers.

TranceNova
 3 years ago
Best ResponseYou've already chosen the best response.1Hmmm.. What if I show you the way I was doing it in excel, would that make any sense to you? (p.s. I definitely not from a programing background.. to tell you the thruth I've never used a loop before)

TranceNova
 3 years ago
Best ResponseYou've already chosen the best response.1oh dear I can't even spell today! Anyway if you look to the far right of the sheet (which I cut alot of data out of so you could see better) you will see the excel functions I've used  basically just to get a percentage of each landuse in the "LCT_1990" column out of each "FID_buffer931" code (which is each site  first column). My "FID_buffer931" gets down to 19, so I don't want to keep doing it manually in excel like I am doing. I was originally trying to stick "q<subset(B,"LCT.1990=bare" & "FID.poly9093=1")" in R just to select one landuse in one site (yes I can hear you cringe at that awful  and wrong  piece of code).

mcnalljj
 3 years ago
Best ResponseYou've already chosen the best response.0hmmm and You're sure that R is the language you'd like to use? Sorry I might be a bit slow at this, your variable names are not terribly stranger friendly. What are you having difficulty with? Is it where you are using sumif in excel?

TranceNova
 3 years ago
Best ResponseYou've already chosen the best response.1Hmm yeah, mainly because its the only other one I remotely know how to use, and I know it can be used for that type of thing.. I'm just missing the how part :P Yeah, they are pretty bad.. that's why I was reluctant to go on lol. Anyway basically "LCT_1990" = is landuse and "FID_buffer931" = site. You see I know how to do it in excel  like you can see  but to do the whole dataset (which is much longer) I would have to keep pasting those excel functions under each block of "sites" or "FID_buffer931" numbers (separated by the colours). I suppose I was trying to be lazy :P and I suspect I should probably go to an R forum hehe.

TranceNova
 3 years ago
Best ResponseYou've already chosen the best response.1Anyway please don't waste time on it! I'm going to bed :)

mcnalljj
 3 years ago
Best ResponseYou've already chosen the best response.0In java or c++ once you'd read these in, I would make them in to objects with, then pass them to functions which would handle the calculations. I'm sorry I was expecting a bit of debugging rather than thinking the whole thing out.
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.