Better idea, Ben!
It would work as you might expect it to to produce the same results as
the above:
##first make sure your regressor is a matrix:
pur2 <- matrix(purity2, ncol =1)
## convert the data frame variables into a matrix
dat <- as.matrix(gem751be.rpkm[ , 74:35164])
##then
result <- residu
You can also fit a linear model with a matrix-valued response
variable, which should be even faster (not sure off the top of my head
how to get the residuals and reshape them to the dimensions you want)
On Fri, Aug 9, 2024 at 9:31 PM Bert Gunter wrote:
>
> See ?lm.fit.
> I must be missing somethi
See ?lm.fit.
I must be missing something, because:
results <- sapply(74:35164, \(i) residuals(lm.fit(purity2,
gem751be.rpkm[, i] )))
would give you a 751 x 35091 matrix of the residuals from each of the
regressions.
I assume it will be considerably faster than all the overhead you are
carrying in
Dear R users,
I am running the following code below, the gem751be.rpkm is a dataframe with
dim of 751 samples by 35164 variables, 73 phenotypic variables in the furst to
73rd column and 35091 genomic variables or genes in the 74th to 35164th
columns. What I need to do is to calculate the res
В Fri, 9 Aug 2024 20:25:51 +0530
Anupam Tyagi пишет:
> I am trying this in Bengaluru, India, using R-studio. I tried
> downloading a single variable. It happened fast, in less than 5
> seconds. I tried downloading six variables, it took much longer, but
> less than a minute. Tried eight variables
Thanks, Martin. I am trying this in Bengaluru, India, using R-studio. I
tried downloading a single variable. It happened fast, in less than 5
seconds. I tried downloading six variables, it took much longer, but less
than a minute. Tried eight variables and it did not download even in five
minutes.
> Ivan Krylov via R-help
> on Fri, 9 Aug 2024 15:23:58 +0300 writes:
> В Thu, 8 Aug 2024 12:43:23 +0530
> Anupam Tyagi пишет:
>> In open.connection(con, "rb") :
>> URL
>>
'https://api.worldbank.org/v2/en/country/OED/indicator/NY.ADJ.NNAT.GN.ZS?format=json&date=1
I tried running the same command on my home computer, and it downloaded in
less than 30 seconds. So, it seems the problem is with internet connection
at work. Thanks, Ivan.
On Fri, 9 Aug 2024 at 18:30, Anupam Tyagi wrote:
> In the browser the link downloads immediately, in less than a second. I
In the browser the link downloads immediately, in less than a second. I let
the command run in R for five minutes, using R Studio. Nothing happened.
On Fri, 9 Aug 2024 at 17:54, Ivan Krylov wrote:
> В Thu, 8 Aug 2024 12:43:23 +0530
> Anupam Tyagi пишет:
>
> > In open.connection(con, "rb") :
> >
В Thu, 8 Aug 2024 12:43:23 +0530
Anupam Tyagi пишет:
> In open.connection(con, "rb") :
> URL
> 'https://api.worldbank.org/v2/en/country/OED/indicator/NY.ADJ.NNAT.GN.ZS?format=json&date=1977:2020&per_page=32500&page=1':
> Timeout of 60 seconds was reached
If you try to open the link in the brow
Oh I thought that was just my experience of it !! So didn't want to slate
it too much!!
Yes, I nearly said "without making it an object of objects". I guess it
depends what they want to do with those objects in the end.
Usually if I want a function to manipulate two things I create two
functions.
On 2024-08-09 6:21 a.m., Bert Gunter wrote:
"Or use <<- assignment I think. (I usually return, but return can only
return one object and I think you want two or more"
You can return any number of objects by putting them in a list and
returning the list.
Use of "<<-" is rarely a good idea in R.
Thanks. Hmm, I like the idea of returning a list. I occasionally use
“invisible” and am still trying to figure out its difference with return.
Where do I read about <<- assignment?
On 8/9/2024 6:21 PM, Bert Gunter wrote:
> "Or use <<- assignment I think. (I usually return, but return can only
>
"Or use <<- assignment I think. (I usually return, but return can only
return one object and I think you want two or more"
You can return any number of objects by putting them in a list and
returning the list.
Use of "<<-" is rarely a good idea in R.
-- Bert
On Fri, Aug 9, 2024 at 1:53 AM CALUM
OK. The fact it's in a function is making things clearer.
Are you trying to update the values of an object from within the function,
and have them available outside the function. I don't speak functional
programming articulately enough but basically
v <- 1
funA <- function() {
v <- v+1
}
funA()
Thanks. Hmm. The loop is doing what it is supposed to do.
> try1<-function(joint12=FALSE,marg1=FALSE,marg2=FALSE,
+ cond12=FALSE,cond21=FALSE){
+ # ***
+ # Testing if loop
+ # ***
+ if(j
16 matches
Mail list logo