Hello R gurus,
I have a simple routine using for loops that i was just trying to make it
faster
y - rnorm(10)
Nindiv - 10
x -matrix(sample(c(0:2),50,re = T),10)
gtemp - rnorm(10)
ycorr - array(0,c(Nindiv,1))
for (i in 1:Nindiv) {
for (k in 1:ncol(x)) {
ycorr[i] - y[i] -
Ok, I am sorry, I was building a reproducible example to post here and I made
a mistake. Th second loop (in the variable k) updates ycorr.
Therefore, it would be
ycorr - rnorm(10)
Nindiv - 10
x -matrix(sample(c(0:2),50,re = T),10)
gtemp - rnorm(10)
for (i in 1:Nindiv) {
for (k in
Hi,
I have a simple task, but I am looking for a clever and fast way to do it:
I have a vector x with 0,1 or 2 and I want to create another vector y with
the same length following the rules:
If the element in x is equal to 0, the element in y is equal to 0
If the element in x is equal to 2, the
Hi Henrique,
Thanks for the fast answer,
The only problem in your code, which I think I didn't mention in my message
is that I would like one different random sampling procedure for each 1 in
my vector
The way it was written, it samples only once and replace by every 1:
x =
Hi Guys.
I have a matrix which has names in every other column and the other one is
empity ()
example
X1 X10001 X10002
[1,] AG AG G
[2,] GG AG A
[3,] GG AA A
[4,] GG AA A
[5,] AG AA A
I am creating another matrix (I called
Hi R-helpers,
I need to read some file with different lines (I don't know the number of
lines to skip) and I would like to find a way to start reading the
data.frame from the word source.
ex:
djhsafk
asdfhkjash
shdfjkash
asfhjkash #those lines contain numbers and words, I want to skip
Sorry, the explanation wasn't very good...just to explain better.
I am writing a loop to read and process different files in the same script.
And what I want to load into a variable is a data.frame that is above the
word source in all of my files.
So I would like to recognize the word Source in
Sorry, the explanation wasn't very good...just to explain better.
I am writing a loop to read and process every time a different file in the
same script.
And what I want to load into a variable each time is a data.frame that is
bellow the word source in all of my files.
So I would like to
So, I am having a tricky reference file to extract information from.
The format of the file is
x 1 + 4 * 3 + 5 + 6 + 11 * 0.5
So, the elements that are not being multiplied (1, 5 and 6) and the elements
before the multiplication sign (4 and 11) means actually the reference for
the row in a
any clue??
hello R-helpers,
I have an array
acuracia - array(NA, dim = c(1, 1, A, B, C))
which is first defined and in the example above with dimensions 1x1xAxBxC.
My array is then filled using 3 loops (I am not well familiar yet with
lapply or sapply functions so I am still a loop-user):
I received by email an R package (file.tar.gz) that was created in Linux.
The package was already installed in another computer in linux using
install.packages and it worked
I am not familiar with installing packages but I would like to install it on
Windows
I downloaded the Rtools29.exe and
Ok,
I re-installed the Rtools (now Rtools211 because I was in another computer
with R version 2.10) , and the message now when I tried to install the
package was
Warning: invalid package 'GWSR_1.0.tar.gz'
Erro: ERROR: no packages specified
Warning message:
In install.packages(GWSR_1.0.tar.gz,
Thanks for all the help,
So let me undestand,
The Rtools is currently installed in
c:\Rtools\bin;
c:\Rtools\perl\bin;
c:\Rtools\MinGW\bin;
%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
C:\Program Files (x86)\QuickTime\QTSystem\;
C:\Program Files (x86)\SAS\Shared
Hi,
I am sure there is an easy way to do it, but I can't find it.
I have a data frame that has 15 columns and 7000 rows.
The only values inside the data.frame are aa, ab, bb as you can see an
example bellow.
1 2 3
1 aa ab ab
2 ab ab ab
3 aa aa aa
4 bb bb bb
What I would like to do, is to
14 matches
Mail list logo