Displaying 20 results from an estimated 10000 matches similar to: "Recoding factor labels that are lists into first element of list"
2009 Dec 11
4
extracting vectors from lists of lists
Good evening
I often have as output from simulations a list of various values, vectors
and matrices.
Supposing that I then run said simulation several times, I often want to
extract a particular result from each simulation for plotting and,
ideally, put it in a matrix.
A simple example
v1 <- 1:5
v2 <- 6:10
other1 <- "stuff"
other2 <- "stuff"
set1 <-
2007 May 05
3
the ifelse function
Hi Everyone,
I think I found a problem with the ifelse function: If the condition
argument is NA, it treats it as true. Anyone agree or disagree with this?
Jen
--
Jennifer Dillon
Doctoral Student
Harvard Biostatistics
Room 414B, Building 1
[[alternative HTML version deleted]]
2017 Sep 02
5
readLines() segfaults on large file & question on how to work around
Hi:
I have a 2.1GB JSON file. Typically I use readLines() and
jsonlite:fromJSON() to extract data from a JSON file.
When I try and read in this file using readLines() R segfaults.
I believe the two salient issues with this file are
1). Its size
2). It is a single line (no line breaks)
I can reproduce this issue as follows
#Generate a big file with no line breaks
# In R
>
2007 May 02
3
the Surv function
Hi,
I'm trying to do a simple survival analysis on some data, and I'm having the
following problem (here's my code and the error message):
out <- Surv(fup,event=status)
Error in Surv(fup, event = status) : argument "time2" is missing, with no
default
>From reading the documentation, it seems that I should be able to simply
write: Surv(time1, event) if my data is
2017 Sep 02
1
readLines() segfaults on large file & question on how to work around
Thank you for your suggestion. Unfortunately, while R doesn't segfault
calling readr::read_file() on the test file I described, I get the error
message:
Error in read_file_(ds, locale) : negative length vectors are not allowed
Jen
On Sat, Sep 2, 2017 at 1:38 PM, Ista Zahn <istazahn at gmail.com> wrote:
> As s work-around I suggest readr::read_file.
>
> --Ista
>
>
>
2005 Dec 29
1
Help with Kriging
R Experts,
I'm looking for some help with the geoR package. I'm trying to krig
some data without using a global neighborhood. I would like to set my
moving neighborhood to a distance, say 100 meters, where I know my data
is spatially correlated. I have tried the ksline function, but that
only allows my moving neighborhood to be set to a number of data points.
But, since my data
2017 Sep 03
2
readLines() segfaults on large file & question on how to work around
Jeroen:
Thank you for pointing me to ndjson, which I had not heard of and is
exactly my case.
My experience:
jsonlite::stream_in - segfaults
ndjson::stream_in - my fault, I am running Ubuntu 14.04 and it is too old
so it won't compile the package
corpus::read_ndjson - works!!! Of course it does a different simplification
than jsonlite::fromJSON, so I have to change some code, but
2005 Oct 25
3
making an inicator variable
Hello,
I am almost a total novice, and I am sure there must be an easy (and
basic) way to turn a variable of 1's and 2's into a variable of zeros
and ones. This is in a data frame, but if I could do it with vectors,
that's all I need.
Can someone tell me how?
Thanks so much,
Jen
2018 Jun 19
1
readLines function with R >= 3.5.0
Hi Michael:
I can confirm Martin's comment. I tested my software with r-devel (r74914)
and it works, while with r-patched (r74914) it does not work (it hangs, as
it did in R 3.5.0). I apologize for it taking so long for me to test this,
but is there any chance this fix could make into R 3.5.1?
Thanks.
Jen.
On Wed, Jun 13, 2018 at 6:24 AM, Michael Lawrence <lawrence.michael at gene.com
2016 Dec 15
2
print.POSIXct doesn't seem to use tz argument, as per its example
On the documentation page for DateTimeClasses, in the Examples section,
there are the following two lines:
format(.leap.seconds) # the leap seconds in your time zone
print(.leap.seconds, tz = "PST8PDT") # and in Seattle's
The second line (using print) seems to ignore the tz argument, and prints
the dates in my time zone, while:
format(.leap.seconds, tz =
2018 Jun 13
2
readLines function with R >= 3.5.0
>>>>> Michael Lawrence
>>>>> on Tue, 12 Jun 2018 19:27:49 -0700 writes:
> Hi Jen, This was already resolved for R 3.5.1 by just
> disabling buffering on terminal file connections like stdin.
and before R 3.5.1 exists, *and*
as the change is also not yet available in R patched (!)
this means using a version of
"R-devel", e.g. for Windows
2013 Jul 09
1
[off topic] [research] Interviews for contributors over 50 for Oregon State University research
Hello,
Researchers at Oregon State University are striving to conduct
research to learn more about the free/open source software community
landscape as it relates to older adults. We have identified you as a
leader for a free/open source software community. If you?re
interested, we will either do an in-person interview (if you are local
to the Corvallis or Portland area), or an interview over the
2018 Jun 12
2
readLines function with R >= 3.5.0
Hi:
I have also just stumbled into this bug. Unfortunately, I can not
change the data my program receives from stdin. My code runs in a
larger system and stdin is sent to a Docker container running my R
code. The protocol is I read a line, readLines("stdin", n=1), do some
actions, send output on stdout, and wait for the next set of data. I
don't have control over this protocol, so
2013 Jul 02
2
Recoding variables based on reference values in data frame
I'm new to R (previously used SAS primarily) and I have a genetics data
frame consisting of genotypes for each of 300+ subjects (ID1, ID2, ID3,
...) at 3000+ genetic locations (SNP1, SNP2, SNP3...). A small subset of
the data is shown below:
SNP_ID SNP1 SNP2 SNP3 SNP4 Maj_Allele C G C A Min_Allele T A T G ID1
CC GG CT AA ID2 CC GG CC AA ID3 CC GG
nc
AA
2008 Jul 24
2
factor question
Hi!
Suppose I have a factor:
> fac1 <- factor(rep(c("dog","cat","tree"),c(2,3,4)))
> fac1
[1] dog dog cat cat cat tree tree tree tree
Levels: cat dog tree
> length(fac1)
[1] 9
Now I want to get rid of the dogs:
> fac1 <- fac1[3:9]
> fac1
[1] cat cat cat tree tree tree tree
Levels: cat dog tree
>
How should I remove the dog from the
2013 Jan 25
1
Recoding variables (without recode() )
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130125/859c4520/attachment.pl>
2010 Apr 07
2
recoding variables-recode not working
Hi,
I have numerical variable that I want to recode into categories '0' and '1
and more' and do analysis with that data.
I have tried various of possibilities to do so, but I am sucked and nothing
is working.
recode(Q12, "0='A';1:30='B'")
cut(Q12, breaks=c(0,1,30), lables=c('0', '1 and more'))
cat(Q12, "0=0;1-33=1")
What should
2010 Aug 04
2
French accents on characters
Hello
Could someone please direct me to the correct commands for adding accents
(grave and aigu) to a letter in a plot title, label, or in added text? I'm
sure there's a handy list somewhere, but I've failed in coming up with the
correct search words to find it.
Thank you muchly!
Jen
2012 Aug 24
3
ifelse problem - bug or operator error
Hi R-Helpers,
I don't think I need to post a dataset for this question but if I do, I
can. Anyway, I am having a lot of trouble with the ifelse command.
Here is my code:
vn$PM.DIST_flag <- ifelse( (vn$PM.EXP > 0.0) & (vn$PM.DIST.TOT != 1.0), 1,
0 )
And here is my output that doesn't make ANY sense:
PM.EXP PM.DIST.TOT PM.DIST_flag 0 0 0 0 0 0 0 0 0 177502 1 0 31403
2012 Jul 31
3
Help with NaN when 0 divided by 0
Hi All,
I have some data where I am doing fairly simple calculations, nothing more
than adding, subtracting, multiplying and dividing.
I’m running into a problem when I divide one variable by another and when
they’re both 0 I get NaN. I realize that if you divide a non-zero by 0 then
you get Inf, which is, of course, correct. But in my case I never get Inf,
just NaN because of the structure