Forum Replies Created
- AuthorPosts
bryan
ParticipantFidi,
This is a job for the doBy package; specifically the summaryBy function. The code will be something like:
summaryBy(~disease, data = daten, FUN = length)
Repost if you have any problems.
bryan
ParticipantYou can change this by setting the working directory in the Rprofile.site file. This is in “your-R-version-directory/etc/”.
On a new line add:
setwd("C:/NewSaveLocation")
bryan
ParticipantYou’re on the right track, but a couple of questions…
Should the 11 other files be combined before they are compared to x? And will each file in the 12 file set be an x-file at some point?
bryan
ParticipantThe quantmod package will let you do that and, as an added benefit, it will do it quickly.
The to.period function is what you’ll need. If you have any trouble figuring it out, just post again with the specific error or issue you’re having.
bryan
Participantvmgmax,
I don’t have a direct answer to your question, but this video talks indirectly about combining R and Javascript via JSON. It may give you some answers or ideas.
http://www.youtube.com/watch?v=7x0UdUghANI&hd=1
Bryan
bryan
ParticipantHi RCinLB,
You’ll want to start by looking at the read.csv function help by typing
>?read.csv
(without the “>”) at the R prompt.
If you have trouble interpreting the help, just post what you’re having difficult with.
Bryan
bryan
ParticipantYou could write something to do it manually:
path.sep <- function (x) { if (x == "windows") { "\\" } else { "/" } } path.sep(.Platform$OS.type) Which can be extended to fit numerous needs. .Platform$file.sep is related and might be helpful in other cases, but wouldn't help you in this situation.
bryan
ParticipantOne way to do this is by using parse and eval:
number <- readline("Enter number: ") number <- eval(parse(text = number))
bryan
ParticipantI’d say you’re correct. It’s hard to tell you the best solution without seeing more of your data; it could also be that you have some unexpected characters in the head of the file. row.names = NULL should allow you to bring in the Date variable. You may also want to use read.csv instead of read.table since you’re bringing in a csv file. It will make the call simpler.
bryan
ParticipantTabby,
What error(s) are you getting?
bryan
ParticipantI haven’t seen a comprehensive list, and I would be surprised if one exists given that there are always new packages being released. But here are the functions for generating random numbers from the most common distributions:
rbeta, rbinom, rcauchy, rchisq, rexp, rf, rgamma, rgeom, rhyper,
rlogis, rlnorm, rmultinom, rnbinom, rnorm, rpois, rsignrank, rt,
runif, rweibull, rwilcox, ptukey, qtukeyAstrostats at PSU has a good description of how to use them if you need it:
October 25, 2011 at 5:18 pm in reply to: How to display those animation graphic in Web Environment? #367bryan
ParticipantHi Louis,
Could you output the image to a .png or .jpeg (see ?png) in a folder that your PHP code has access to and bring it in from there?
bryan
ParticipantHi diyanah,
Are you using the EBImage package? That should allow you to open images as an array. From the help:
“RGB images are coded in 8 bits per channel, 24 bits per pixel, stored in an R integer array.”
If not, can you tell us what you are using? The relevant portions of your code would also be helpful.
bryan
ParticipantOne of the most straightforward ways is to create a lagged version of your vector of closing prices and use that in the computation:
x.lag <- c(NA, x[1:(length(x)-1)]) quotient <- x/x.lag
Where 'x' is your vector of prices and your data is sorted by ascending date/time. There are other ways to do this, but this is fairly generalizable code that is easy to change to fit your needs.
bryan
ParticipantYou can use the sample() function to do what you’re trying to do. E.g.:
sample(50:60, size = 1)
You can also draw draw a larger set of numbers with or without replacement if you want:
sample(50:60, size = 3, replace = T)
One related trick – you can chose numbers at specific intervals by adding the seq() function:
sample(seq(50, 60, by = .5), size = 3, replace = T)
- AuthorPosts