Displaying 20 results from an estimated 10000 matches similar to: "Using expression() in plot() XXXX"
2012 Jan 04
3
Using a mathematical expression in sapply() XXXX
Hello everyone,
I have the following call to sapply() and error message. Is the most
efficient way to deal with this to make sum(!is.na(x)) a function in a
separate line prior to this call? If not, please advise.
N.Valid=sapply(x,sum(!is.na(x)))
Error in match.fun(FUN) :
'sum(!is.na(x))' is not a function, character or symbol
Thanks!
Dan
[[alternative HTML version deleted]]
2010 Sep 24
1
Saving iterative components
Hi, I need help!
I am trying to iterate an iterative process to do cross vadation and store
the results each time.
I have a Spatial data.frame, called Tmese
> str(Tmese)
Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
..@ data :'data.frame': 14 obs. of 17 variables:
.. ..$ ID : int [1:14] 73 68 49 62 51 79 69 77 57 53 ...
.. ..$
2024 Apr 16
5
read.csv
Dear R-developers,
I came to a somewhat unexpected behaviour of read.csv() which is trivial but worthwhile to note -- my data involves a protein named "1433E" but to save space I drop the quote so it becomes,
Gene,SNP,prot,log10p
YWHAE,13:62129097_C_T,1433E,7.35
YWHAE,4:72617557_T_TA,1433E,7.73
Both read.cv() and readr::read_csv() consider prot(ein) name as (possibly confused by
2011 Aug 24
3
Importing data from MS EXCEL (.xls) to R XXXX
Hello everyone,
What is the simplest, most RELIABLE way to import data from MS EXCEL (.xls)
format to R? In the past I have used the read.xls() function from the
xlsReadWrite package, however, I have been wrestling with it all afternoon
long with no success. I continue to receive the following error message:
> {widge<-read.xls("F:\\Classes\\Z1.Data\\stat.3010\\WidgeOne.xls",
+
2003 Dec 09
2
problem with pls(x, y, ..., ncomp = 16): Error in inherit s( x, "data.frame") : subscript out of bounds
I don't know the details of pls (in the pls.pcr package, I assume), but if
you use validation="CV", that says you want to use CV to select the best
number of components. Then why would you specify ncomp as well?
Andy
> From: ryszard.czerminski at pharma.novartis.com
>
> When I try to use ncomp parameter in pls procedure I get
> following error:
>
> >
2012 Jan 17
3
Using !is.na() in a HAVING clause in sqldf() XXXX
Hi everyone,
I have the following:
sqldf("select Premie,count(tpounds) N,avg(tpounds) Avg_Weight,
stddev_samp(tpounds) StdDev
from children
group by Premie
having !is.na(Premie)")
sqldf() does not like the !is.na(Premie) specification. How does one
exclude a "missing" group in an aggregated query using sqldf()?
Thanks!
Dan
[[alternative HTML version deleted]]
2013 Mar 25
3
Obtaining the internal integer codes of a factor XXXX
Hi everyone,
I understand the process of obtaining the internal integer codes for
the raw values of a factor (using as.numeric() as below), but what is
the best way to obtain these codes for the levels() of a factor (since
the as.numeric() results don't really make clear which code maps to
which level)?
2012 Mar 02
3
Memory issue. XXXX
Hi everyone,
Any ideas on troubleshooting this memory issue:
> d1<-read.csv("arrears.csv")
Error: cannot allocate vector of size 77.3 Mb
In addition: Warning messages:
1: In class(data) <- "data.frame" :
Reached total allocation of 1535Mb: see help(memory.size)
2: In class(data) <- "data.frame" :
Reached total allocation of 1535Mb: see
2011 Nov 28
1
2 Y-AXIS labels on the same (left-hand side) Y-AXIS XXXX
Hello everyone,
Is it possible to specify a 2 line y-axis label on the same lef-hand side
y-axis? I am using the \n regular expression, but only the 2nd line appears
(I assume the 1st line is printed off the page...)
plot(PRE_SHB,R1,
main="Figure 1.1: Scatterplot of Residualized
Post Score",
xlab = "Pre Score",
ylab = "Residualized Post Score \n
(Adjusted for Age
2012 Jan 13
2
Merging data XXXX
Hello everyone,
I have 1 data frame (just a vector in the example below) with 12
individuals listed and a separate vector of 36 days (in week intervals).
What is the best way to merge these together so that each individual
("specialist" here) has all 36 days matched with their specialist number (a
one to many merge in SAS; essentially resulting in long format data).
2012 Mar 07
2
Remove a word from a character vector value XXXX
Hi everyone,
What is the easiest way to remove the word Average and strip leading
and trailing blanks from the character vector (d5.Region) below?
.nrow.d5. d5.Region
1 1 Central Average
2 2 Coastal Average
3 3 East Average
4 4 Metro East Average
5 5 Metro North Average
6 6 Metro South Average
7
2011 Aug 27
2
Placing a column name in a variable XXXX
Hi everyone,
How does one place an object name (in this case a vector name) into another
object (while essentially masking the values of the first object?
For example:
> JOBSAT<-rnorm(40)
>
> CI<-function(x,alpha){
+ result<-cbind(x,mean=mean(x),alpha)
+ print(result)
+ }
> CI(JOBSAT,.05)
I want this to return:
Variable mean alpha
JOBSTAT 0.02844131 0.05
2012 Jan 24
2
Writing a function to return column position XXXX
Hello everyone,
I am writing my own function to return the column index of all variables
(these are currently character vectors) in a data frame that contain a
dollar sign($). A small piece of the data look like this:
can_sta can_zip ind_ite_con ind_uni_con AL 36106 $251,895.80 $22,874.43
AL 35802 $141,373.60 $7,100.00 AL 35201 $273,208.50 $18,193.66 AR
72404 $186,918.00
$25,391.00 AR
2011 Sep 01
2
Including only a subset of the levels of a factor XXXX
Hello everyone,
I have the following factor:
levels(pp_income)
[1] "" "1" "2" "3" "4" "5" "6" "7"
[9] "8" "9" "Renter"
I want to subset so that only values 1:9 are included. I have the following:
> income<-pp_income[pp_income %in%
2012 Jan 19
2
Reading in tab (and space) delimited data within a script XXXX
Hello everyone,
I use Bob Muenchen's approach for reading in "in-stream" (to use SAS
parlance) delimited data within a script. This works great:
mystring <-
"id,workshop,gender,q1,q2,q3,q4
1,1,f,1,1,5,1
2,2,f,2,1,4,1
3,1,f,2,2,4,3
4,2, ,3,1, ,3
5,1,m,4,5,2,4
6,2,m,5,4,5,5
7,1,m,5,3,4,4
8,2,m,4,5,5,5"
mydata <- read.table( textConnection(mystring),
2011 Dec 30
2
Applyiing mode() or class() to each column of a data.frame XXXX
Hi everyone,
I am attempting to use the apply() function to obtain the mode and class of
each column in a data frame, however, I am encountering unexpected results.
I have the following example data:
v13<-1:6
v14<-c(1,2,3,3,NA,1)
v15<-c("Good","Bad",NA,"Good","Bad","Bad")
2024 Apr 16
1
read.csv
?s 11:46 de 16/04/2024, jing hua zhao escreveu:
> Dear R-developers,
>
> I came to a somewhat unexpected behaviour of read.csv() which is trivial but worthwhile to note -- my data involves a protein named "1433E" but to save space I drop the quote so it becomes,
>
> Gene,SNP,prot,log10p
> YWHAE,13:62129097_C_T,1433E,7.35
> YWHAE,4:72617557_T_TA,1433E,7.73
>
2011 Jan 24
5
Train error:: subscript out of bonds
Hi,
I am trying to construct a svmpoly model using the "caret" package (please
see code below). Using the same data, without changing any setting, I am
just changing the seed value. Sometimes it constructs the model
successfully, and sometimes I get an ?Error in indexes[[j]] : subscript out
of bounds?.
For example when I set seed to 357 following code produced result only for 8
2024 Apr 16
1
read.csv
Gene names being misinterpreted by spreadsheet software (read.csv is
no different) is a classic issue in bioinformatics. It seems like
every practitioner ends up encountering this issue in due time. E.g.
https://pubmed.ncbi.nlm.nih.gov/15214961/
https://genomebiology.biomedcentral.com/articles/10.1186/s13059-016-1044-7
https://www.nature.com/articles/d41586-021-02211-4
2013 Oct 08
1
Summary functions in sqldf() XXXX
Hi everyone,
Is it possible to obtain the 1st & 3rd quartiles & the median in a sqldf()
select statement? If so, can you please provide the summary fn code?
Thanks!
Dan
[[alternative HTML version deleted]]