Justin

United States

Age: 30

Apr
9
comment Processing a string using as.yearqtr
The error happens in the call to as.yearmon where it converts %q to %m and back. Since %m can take 1 or 2 digit months, it cannot determine what to do with the string: is Q123 2013-01 or is it 2003-12. Instead of inserting a space, you can zero pad the quarter Q0413 and will get the expected results.
Apr
9
comment Processing a string using as.yearqtr
As a work around, you could add a space to each string at 2 characters, but I'd say this looks like a bug. I haven't dug into the zoo source to see the implementation though...
Apr
8
comment declare a function at first and then define it later in R
Your question isn't completely clear to me. Since R is not compiled, changing the definition of a function that is called inside another function will have the expected effect. If you run the code above (with some changes to make it work...) and then call fn again, it will use the new definition of f2.
Apr
8
comment Why are some points on my R plot bolded?
If any of the answers address your issue, please mark the checkbox next to them so others can see that this question is answered.
Apr
8
answered Why are some points on my R plot bolded?
Apr
8
comment Why are some points on my R plot bolded?
Welcoem to SO. Without seeing the data, we can't say for sure. However, my guess would be that there are multiple values plotted on that same location: plot(c(1,1,1,1,2), c(1,1,1,1,1), pch=2).
Apr
8
reviewed Approve suggested edit on .Net Remoting serialization issue
Apr
2
comment How to select the maximum value of each subgroup after sorting
Welcome to SO. This is a very common operation in R and is known as the split-apply-combine strategy. Please show us what you've tried and where you have looked prior to posting here.
Mar
24
comment for loop to apply in R
it is... but we don't know what fun is... so we can't answer much...
Mar
24
comment for loop to apply in R
Without knowing what fun it is impossible to say. However, apply will only really help speed up the creation of the result matrix. It will not speed up fun at all. Please create a (reproducible example)[stackoverflow.com/questions/5963269/… that includes fun and i.
Mar
17
comment Split words in r
Is each sentence on its own line? And what do you mean when you say the words have "merged"?
Feb
25
comment join or merge values calculated on grouped pandas dataframe
I don't have pysal, but you should be able to return a pd.Series and have better luck. return pd.Series(intervals.yb).
Feb
24
comment Combining logic statements AND in numpy array
The parentheses are also important. x<8 & x>2 will fail with a similar error.
Feb
24
comment Checking if string is in uppercase in R
s == toupper(s)?
Feb
20
comment Calculations and rounding in R
wrap it in integer!
Feb
20
comment Calculations and rounding in R
This is due to floating point error. Look at the result of 0.94/100*100*100 - 94. So while R prints 94, the number is stored as something ever so slightly less than 94. see this question
Feb
20
revised How to "attach" the "i" in a for loop to a vector name in R
added 24 characters in body
Feb
20
comment SED command to change the header
Improved formatting will help, but surely there is a way to accomplish what you're looking for in R proper. Can you share a bit of the actual data (paste the result of dput(head(yourdata))).
Feb
19
comment Setting a loop in R
When using external packages, please include them somewhere in your question (e.g. library(protr)). Also, since props=..., lambda=30, w=0.05 and customprops=NULL are all defaults, you don't need to pass them at all. extractAPAAC(seq) is equivalent. Please show the exact code you ran and the exact error message if you want us to help debug.
Feb
19
comment How to calculate the mean of few columns and put the result in new column?
why do you need the subset? data$mean_length <- rowMeans(data) should be plenty...
1 2 3 4 5