I think this may be too easy for all of you, but it is driving me crazy and I googled for straight 2 hours now, but I cannot solve this. I just started using R today and just trying to do a simple LM to get started.
This is my code:
library(readxl)
IPO <- read_excel("C:/Test.xlsx", sheet = "Tabelle1",
col_types = c("text","numeric", "numeric", "numeric", "numeric", "numeric"))
results <- lm(value~Age+Education)
So, I just import my data from an XLS file using readxl, which works and I get my data, as IPO is now listed under "Data".
But if I run the linear regression command, I get this error:
"Error in eval(predvars, data, env) : object 'value' not found"
I know that "Value" is not listed as a Value in R, but how can I change this?
I was using this video as reference:
https://www.youtube.com/watch?v=S-zKhFr91Tg&t=253s
When he runs the lm command, the Field "Values" (I know it`s the same name, but this is coincidence) the header "Values" under "Data" is created automatically - this does not happen when I try it.
Help?!
The Data:
https://pastebin.com/rdWYpBPR
Sorry, if this is too easy to ask. I just don´t know what to do.
Thanks in advance.
Related
I want to create a CytoTree CYT object in R to analyse my .FCS files. When I am using the Quick start code in the package description, I will always get an error when running the createCYT() function that says:
Error in createCYT(raw.data = fcs.data, normalization.method = "log") :
2022-09-26 15:46:26 meta.data must be a data.frame
As the function should not rely on any meta data and that object is optional, I do not know how to solve the error.
Here is the description:
https://ytdai.github.io/CytoTree/quick-start.html#quick-start-code
I thank you very much in advance for your help!
BR
I have encountered same problem previously.
In the end it worked only when the data.frame was added (yes, even though it should not depend on it).
Here is how:
meta.data <- data.frame(cell = rownames(fcs.data), stage = gsub(".fcs.+", "", rownames(fcs.data)))
meta.data$stage <- factor(as.character(meta.data$stage))
You may as well have a look at the Cytotree PDF in case of more issues.
I'm new to R and I'm following videos to import my data. Now, I'm having a hard time in applying some functions, like mean, summary, view (column) etc. It always shows the error: "object" is not found. I've tried many things but I'm stucked here for 2 days!
Can you help me? Thanks a lot!
#Video https://www.youtube.com/watch?v=cnD1op2Oo3M&list=PLtL57Fdbwb_Chn-dNR0qBjH3esKS2MXY3&index=4&ab_channel=RProgramming101
#Create the WD and view the table
library(readxl)
TMA_data <- read_excel("C:/Users/p1160413/Desktop/TMA R studio/TMA
data/dataforR.xlsx",
sheet = "Sheet2")
View(TMA_data)
#Test if it find the table and applies function
TMA_data
MeanAge <- mean(Age)
Result: Error in mean(Age) : object 'Age' not found
I am very much a novice with R and am attempting to run a script that will filter a set of SNPs for 6 populations. I've successfully run this script before but I'm getting a new error in the initial stages of the script.
I've not been able to find anything similar to my issue online, though a few have the same error. The error comes up when R is trying to read in the SNP data and the function and error are as follows from the console screen:
>FijiHomaGL <- gl.read.dart(filename = "genCSV_modified.csv", ind.metafile = "COV_file.csv",
+ nas = "-", topskip = 6, lastmetric = TRUE, probar = TRUE)
Starting gl.read.dart
Starting utils.read.dart
Reading in the SNP data
Error in FUN(X[[i]], ...) :
only defined on a data frame with all numeric variables
A screenshot of the .csv file I'm trying to run
I'm not able to include the actual file but a screenshot is linked above for a general idea of the layout.
Any help is much appreciated I am very new so let me know if there is anything else I should include! Thanks in advance. The package being used for this function is dartR but I can't add it as a tag.
I have the correct package alr4 which contains cars so it shouldn't be a problem with the function itself
box <- lm(Distance~Speed, data = stop)
boxCox(box)
This is the error
Error in as.data.frame.default(data, optional = TRUE) : cannot coerce class ‘"function"’ to a data.frame
The lm function runs just fine on its own, and I have used it in other analysis just fine, so it isn't an issue there. I am mostly just confused about the error and how to fix it. If you have suggestions or know why it happens that would be appreciated! Thanks
I am new to R and to actually asking a question in Stack Overflow. I looked at several similar questions, but they did not seem to apply to help my situation. I am trying to make a linear model with the lm() function, but I get an error returned that states one of my data frame columns is able to be found:
library(SemiPar) # Contains Janka data
data(janka)
names(janka) <- c("Density", "Hardness")
janka.ls1 <- lm(hardness~dens, Data = janka)
I get the following error after running the final line:
Error in eval(predvars, data, env) : object 'Hardness' not found
As you can see, I named one of the two columns 'Hardness' and when I view the data I also see that the names do match. Further, when I try running the code using the original data column name, it still has the same issue.
Thanks for your help!!