Ask your own question, for FREE!
Mathematics 17 Online
OpenStudy (trancenova):

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).

OpenStudy (anonymous):

You'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.

OpenStudy (anonymous):

R is good for data manipulation?

OpenStudy (trancenova):

Yeah 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!

OpenStudy (anonymous):

I have never used R and nor I am looking forward to using it ... btw what about sql or my sql?

OpenStudy (trancenova):

Haven'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

OpenStudy (anonymous):

use nested if statements that cycle through your data and break if a requirement isn't met?

OpenStudy (trancenova):

Thanks 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!

OpenStudy (anonymous):

while(!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.

OpenStudy (trancenova):

Hmmm.. 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)

OpenStudy (trancenova):

oh 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).

OpenStudy (anonymous):

hmmm 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?

OpenStudy (trancenova):

Hmm 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.

OpenStudy (trancenova):

Anyway please don't waste time on it! I'm going to bed :)

OpenStudy (anonymous):

In 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.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!