Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it, follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!
R is a programming language and software environment for statistical computing and graphics. The R language has become a de facto standard among statisticians for developing statistical software, and is widely used for statistical software development and data analysis.
Now that that's out of the way.... here's my problem.
I have a data frame. Lets call the data frame "object." When I type str(object) I get
So far everything looks good. I want to isolate specific rows of my data frame according levels of Region, Have.Data and Use.Level variables. For some reason I can do this with say, 2 of those variables, but the third. For example, I can do something like this:
> Region[58]
[1] C
Levels: C N S
> (Region[58]=="C")
[1] TRUE
> (Region[58]=="C")&(Have.Data[58]=="Y")
[1] TRUE
So clearly at observation 58, I can see that the Region is labelled C, and it returns TRUE if I ask if Region[58] is C. Similarly I can do that when I ask if both are at certain levels simultaneously.
For some reason this falls apart when I try to do it for the Use.Level variable.
Yeah, for whatever reason, your level labels in Use.Level include quotation marks in the level name, while those for your other factors don't. Either compare it to “M” ( like (Use.Level[58]=="“M”") ) or try to figure out why the quotes are there in the first place and remove them.
Hm... that's really strange. Looking at the original .csv it looks like this:
"Region" "Have.Data" "Use.Level"
"C" "N" “N”
"C" "N" “N”
"C" "N" “N”
"C" "N" “N”
"S" "N" “N”
"S" "N" “N”
"S" "N" “N”
"C" "N" “N”
"C" "N" “N”
Not sure why its behaving differently.. I guess I'll try playing around with it.
Posts
Could it be that the values for Region are simply C, N and S while the values of Use.Level are "H", "L", "M" ? (Note the added quotation marks).
Not sure why its behaving differently.. I guess I'll try playing around with it.
Thanks H/A!